diff --git a/core/modules/menu_link/lib/Drupal/menu_link/MenuLinkStorageController.php b/core/modules/menu_link/lib/Drupal/menu_link/MenuLinkStorageController.php index c6f2c1b..ea41970 100644 --- a/core/modules/menu_link/lib/Drupal/menu_link/MenuLinkStorageController.php +++ b/core/modules/menu_link/lib/Drupal/menu_link/MenuLinkStorageController.php @@ -25,6 +25,12 @@ class MenuLinkStorageController extends DatabaseStorageController implements MenuLinkStorageControllerInterface { /** + * Contains all {menu_router} fields without weight. + * @var array + */ + protected static $routerItemFields; + + /** * Indicates whether the delete operation should re-parent children items. * * @var bool @@ -56,6 +62,10 @@ public function __construct($entity_type, array $entity_info, Connection $databa parent::__construct($entity_type, $entity_info, $database, $uuid_service); $this->routeProvider = $route_provider; + + if (empty(static::$routerItemFields)) { + static::$routerItemFields = array_diff(drupal_schema_fields_sql('menu_router'), array('weight')); + } } /** @@ -84,6 +94,17 @@ public static function createInstance(ContainerInterface $container, $entity_typ } /** + * Overrides DatabaseStorageController::buildQuery(). + */ + protected function buildQuery($ids, $revision_id = FALSE) { + $query = parent::buildQuery($ids, $revision_id); + // Specify additional fields from the {menu_router} table. + $query->leftJoin('menu_router', 'm', 'base.link_path = m.path'); + $query->fields('m', static::$routerItemFields); + return $query; + } + + /** * Overrides DatabaseStorageController::save(). */ public function save(EntityInterface $entity) {