diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php b/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php index dd4c028..bd0fea3 100644 --- a/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php @@ -134,7 +134,7 @@ public function load(array $ids = NULL) { // Remove any invalid ids from the array. $passed_ids = array_intersect_key($passed_ids, $entities); foreach ($entities as $entity) { - $passed_ids[$entity->{$this->idKey}] = $entity; + $passed_ids[$entity->id()] = $entity; } $entities = $passed_ids; } @@ -292,7 +292,7 @@ public function create(array $values) { // Assign a new UUID if there is none yet. if (!isset($entity->{$this->uuidKey})) { $uuid = new Uuid(); - $entity->{$this->uuidKey} = $uuid->generate(); + $entity->set($this->uuidKey, $uuid->generate()); } // Modules might need to add or change the data initially held by the new diff --git a/core/modules/block/lib/Drupal/block/BlockBase.php b/core/modules/block/lib/Drupal/block/BlockBase.php index 4de2a59..df6f804 100644 --- a/core/modules/block/lib/Drupal/block/BlockBase.php +++ b/core/modules/block/lib/Drupal/block/BlockBase.php @@ -243,7 +243,7 @@ public function form($form, &$form_state) { $form['label_display'] = array( '#type' => 'checkbox', '#title' => t('Display title'), - '#default_value' => $entity->label_display == BLOCK_LABEL_VISIBLE ? TRUE : FALSE, + '#default_value' => $entity->get('label_display') == BLOCK_LABEL_VISIBLE ? TRUE : FALSE, '#return_value' => BLOCK_LABEL_VISIBLE, ); $form['machine_name'] = array( diff --git a/core/modules/block/lib/Drupal/block/Plugin/Core/Entity/Block.php b/core/modules/block/lib/Drupal/block/Plugin/Core/Entity/Block.php index 077a81e..88e0c88 100644 --- a/core/modules/block/lib/Drupal/block/Plugin/Core/Entity/Block.php +++ b/core/modules/block/lib/Drupal/block/Plugin/Core/Entity/Block.php @@ -43,14 +43,14 @@ class Block extends ConfigEntityBase { * * @var string */ - public $id; + protected $id; /** * The block label. * * @var string */ - public $label; + protected $label; /** * Whether the block label is displayed to end users. @@ -61,14 +61,14 @@ class Block extends ConfigEntityBase { * * @var string */ - public $label_display = BLOCK_LABEL_VISIBLE; + protected $label_display = BLOCK_LABEL_VISIBLE; /** * The block UUID. * * @var string */ - public $uuid; + protected $uuid; /** * The plugin instance settings. diff --git a/core/modules/contact/lib/Drupal/contact/CategoryFormController.php b/core/modules/contact/lib/Drupal/contact/CategoryFormController.php index d60308f..6fcfaea 100644 --- a/core/modules/contact/lib/Drupal/contact/CategoryFormController.php +++ b/core/modules/contact/lib/Drupal/contact/CategoryFormController.php @@ -42,20 +42,20 @@ public function form(array $form, array &$form_state, EntityInterface $category) $form['recipients'] = array( '#type' => 'textarea', '#title' => t('Recipients'), - '#default_value' => implode(', ', $category->recipients), + '#default_value' => implode(', ', $category->get('recipients')), '#description' => t("Example: 'webmaster@example.com' or 'sales@example.com,support@example.com' . To specify multiple recipients, separate each e-mail address with a comma."), '#required' => TRUE, ); $form['reply'] = array( '#type' => 'textarea', '#title' => t('Auto-reply'), - '#default_value' => $category->reply, + '#default_value' => $category->get('reply'), '#description' => t('Optional auto-reply. Leave empty if you do not want to send the user an auto-reply message.'), ); $form['weight'] = array( '#type' => 'weight', '#title' => t('Weight'), - '#default_value' => $category->weight, + '#default_value' => $category->get('weight'), '#description' => t('When listing categories, those with lighter (smaller) weights get listed before categories with heavier (larger) weights. Categories with equal weights are sorted alphabetically.'), ); $form['selected'] = array( diff --git a/core/modules/contact/lib/Drupal/contact/CategoryListController.php b/core/modules/contact/lib/Drupal/contact/CategoryListController.php index a3ec886..0cc7a42 100644 --- a/core/modules/contact/lib/Drupal/contact/CategoryListController.php +++ b/core/modules/contact/lib/Drupal/contact/CategoryListController.php @@ -53,7 +53,7 @@ public function buildHeader() { */ public function buildRow(EntityInterface $entity) { $row['category'] = check_plain($entity->label()); - $row['recipients'] = check_plain(implode(', ', $entity->recipients)); + $row['recipients'] = check_plain(implode(', ', $entity->get('recipients'))); $default_category = config('contact.settings')->get('default_category'); $row['selected'] = ($default_category == $entity->id() ? t('Yes') : t('No')); $row['operations']['data'] = $this->buildOperations($entity); diff --git a/core/modules/contact/lib/Drupal/contact/Plugin/Core/Entity/Category.php b/core/modules/contact/lib/Drupal/contact/Plugin/Core/Entity/Category.php index f01c2f5..11dd2c2 100644 --- a/core/modules/contact/lib/Drupal/contact/Plugin/Core/Entity/Category.php +++ b/core/modules/contact/lib/Drupal/contact/Plugin/Core/Entity/Category.php @@ -39,41 +39,41 @@ class Category extends ConfigEntityBase { * * @var string */ - public $id; + protected $id; /** * The category UUID. * * @var string */ - public $uuid; + protected $uuid; /** * The category label. * * @var string */ - public $label; + protected $label; /** * List of recipient e-mail addresses. * * @var array */ - public $recipients = array(); + protected $recipients = array(); /** * An auto-reply message to send to the message author. * * @var string */ - public $reply = ''; + protected $reply = ''; /** * Weight of this category (used for sorting). * * @var int */ - public $weight = 0; + protected $weight = 0; } diff --git a/core/modules/image/lib/Drupal/image/Plugin/Core/Entity/ImageStyle.php b/core/modules/image/lib/Drupal/image/Plugin/Core/Entity/ImageStyle.php index 2c01d95..7d63d75 100644 --- a/core/modules/image/lib/Drupal/image/Plugin/Core/Entity/ImageStyle.php +++ b/core/modules/image/lib/Drupal/image/Plugin/Core/Entity/ImageStyle.php @@ -42,21 +42,21 @@ class ImageStyle extends ConfigEntityBase { * * @var string */ - public $name; + protected $name; /** * The image style label. * * @var string */ - public $label; + protected $label; /** * The array of image effects for this image style. * * @var string */ - public $effects; + protected $effects; /** * Overrides Drupal\Core\Entity\Entity::id(). diff --git a/core/modules/menu/lib/Drupal/menu/MenuListController.php b/core/modules/menu/lib/Drupal/menu/MenuListController.php index e557d92..be040aa 100644 --- a/core/modules/menu/lib/Drupal/menu/MenuListController.php +++ b/core/modules/menu/lib/Drupal/menu/MenuListController.php @@ -35,7 +35,7 @@ public function buildRow(EntityInterface $entity) { 'data' => check_plain($entity->label()), 'class' => array('menu-label'), ); - $row['description'] = filter_xss_admin($entity->description); + $row['description'] = filter_xss_admin($entity->get('description')); $row['operations']['data'] = $this->buildOperations($entity); return $row; } diff --git a/core/modules/shortcut/lib/Drupal/shortcut/Plugin/Core/Entity/Shortcut.php b/core/modules/shortcut/lib/Drupal/shortcut/Plugin/Core/Entity/Shortcut.php index fd72e3c..8fb9208 100644 --- a/core/modules/shortcut/lib/Drupal/shortcut/Plugin/Core/Entity/Shortcut.php +++ b/core/modules/shortcut/lib/Drupal/shortcut/Plugin/Core/Entity/Shortcut.php @@ -38,28 +38,28 @@ class Shortcut extends ConfigEntityBase { * * @var string */ - public $id; + protected $id; /** * The UUID for the configuration entity. * * @var string */ - public $uuid; + protected $uuid; /** * The human-readable name of the configuration entity. * * @var string */ - public $label; + protected $label; /** * An array of menu links. * * @var array */ - public $links = array(); + protected $links = array(); /** * Overrides \Drupal\Core\Entity\Entity::uri(). diff --git a/core/modules/shortcut/lib/Drupal/shortcut/ShortcutStorageController.php b/core/modules/shortcut/lib/Drupal/shortcut/ShortcutStorageController.php index 4463a86..9122359 100644 --- a/core/modules/shortcut/lib/Drupal/shortcut/ShortcutStorageController.php +++ b/core/modules/shortcut/lib/Drupal/shortcut/ShortcutStorageController.php @@ -22,10 +22,12 @@ protected function attachLoad(&$queried_entities, $revision_id = FALSE) { parent::attachLoad($queried_entities, $revision_id); foreach ($queried_entities as $id => $entity) { - $links = menu_load_links('shortcut-' . $id); - foreach ($links as $menu_link) { - $entity->links[$menu_link->uuid()] = $menu_link; + $links = array(); + $loaded_links = menu_load_links('shortcut-' . $id); + foreach ($loaded_links as $menu_link) { + $links[$menu_link->uuid()] = $menu_link; } + $entity->set('links', $links); } } diff --git a/core/modules/shortcut/shortcut.module b/core/modules/shortcut/shortcut.module index 25a04c7..ae99cc5 100644 --- a/core/modules/shortcut/shortcut.module +++ b/core/modules/shortcut/shortcut.module @@ -516,7 +516,7 @@ function shortcut_preprocess_page(&$variables) { $shortcut_set = shortcut_current_displayed_set(); // Check if $link is already a shortcut and set $link_mode accordingly. - foreach ($shortcut_set->links as $uuid => $shortcut) { + foreach ($shortcut_set->get('links') as $uuid => $shortcut) { if ($link == $shortcut['link_path']) { $mlid = $shortcut['mlid']; break; diff --git a/core/modules/system/lib/Drupal/system/Plugin/Core/Entity/Menu.php b/core/modules/system/lib/Drupal/system/Plugin/Core/Entity/Menu.php index 4b63d9b..a06a931 100644 --- a/core/modules/system/lib/Drupal/system/Plugin/Core/Entity/Menu.php +++ b/core/modules/system/lib/Drupal/system/Plugin/Core/Entity/Menu.php @@ -34,27 +34,27 @@ class Menu extends ConfigEntityBase { * * @var string */ - public $id; + protected $id; /** * The menu UUID. * * @var string */ - public $uuid; + protected $uuid; /** * The human-readable name of the menu entity. * * @var string */ - public $label; + protected $label; /** * The menu description. * * @var string */ - public $description; + protected $description; } diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/Core/Entity/Vocabulary.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/Core/Entity/Vocabulary.php index c125418..b522146 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/Core/Entity/Vocabulary.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/Core/Entity/Vocabulary.php @@ -37,21 +37,21 @@ class Vocabulary extends ConfigEntityBase { * * @var string */ - public $vid; + protected $vid; /** * Name of the vocabulary. * * @var string */ - public $name; + protected $name; /** * Description of the vocabulary. * * @var string */ - public $description; + protected $description; /** * The type of hierarchy allowed within the vocabulary. @@ -63,14 +63,14 @@ class Vocabulary extends ConfigEntityBase { * * @var integer */ - public $hierarchy = TAXONOMY_HIERARCHY_DISABLED; + protected $hierarchy = TAXONOMY_HIERARCHY_DISABLED; /** * The weight of this vocabulary in relation to other vocabularies. * * @var integer */ - public $weight = 0; + protected $weight = 0; /** * Implements Drupal\Core\Entity\EntityInterface::id(). diff --git a/core/modules/taxonomy/taxonomy.admin.inc b/core/modules/taxonomy/taxonomy.admin.inc index 6305e48..c1f0c47 100644 --- a/core/modules/taxonomy/taxonomy.admin.inc +++ b/core/modules/taxonomy/taxonomy.admin.inc @@ -21,13 +21,13 @@ function taxonomy_overview_vocabularies($form) { $form['#tree'] = TRUE; foreach ($vocabularies as $vocabulary) { $form[$vocabulary->id()]['#vocabulary'] = $vocabulary; - $form[$vocabulary->id()]['name'] = array('#markup' => check_plain($vocabulary->name)); + $form[$vocabulary->id()]['name'] = array('#markup' => check_plain($vocabulary->label())); $form[$vocabulary->id()]['weight'] = array( '#type' => 'weight', - '#title' => t('Weight for @title', array('@title' => $vocabulary->name)), + '#title' => t('Weight for @title', array('@title' => $vocabulary->label())), '#title_display' => 'invisible', '#delta' => 10, - '#default_value' => $vocabulary->weight, + '#default_value' => $vocabulary->get('weight'), ); $links = array(); $links['edit'] = array( diff --git a/core/modules/tour/lib/Drupal/tour/Plugin/Core/Entity/Tour.php b/core/modules/tour/lib/Drupal/tour/Plugin/Core/Entity/Tour.php index 12ca122..cb3b26a 100644 --- a/core/modules/tour/lib/Drupal/tour/Plugin/Core/Entity/Tour.php +++ b/core/modules/tour/lib/Drupal/tour/Plugin/Core/Entity/Tour.php @@ -36,14 +36,14 @@ class Tour extends ConfigEntityBase { * * @var string */ - public $id; + protected $id; /** * The label of the tour. * * @var string */ - public $label; + protected $label; /** * The paths in which this tip can be displayed. diff --git a/core/modules/user/lib/Drupal/user/Plugin/Core/Entity/Role.php b/core/modules/user/lib/Drupal/user/Plugin/Core/Entity/Role.php index f64955c..a49c074 100644 --- a/core/modules/user/lib/Drupal/user/Plugin/Core/Entity/Role.php +++ b/core/modules/user/lib/Drupal/user/Plugin/Core/Entity/Role.php @@ -34,27 +34,27 @@ class Role extends ConfigEntityBase { * * @var string */ - public $id; + protected $id; /** * The UUID of this role. * * @var string */ - public $uuid; + protected $uuid; /** * The human-readable label of this role. * * @var string */ - public $label; + protected $label; /** * The weight of this role in administrative listings. * * @var int */ - public $weight; + protected $weight; } diff --git a/core/modules/user/user.admin.inc b/core/modules/user/user.admin.inc index c3931d8..e481415 100644 --- a/core/modules/user/user.admin.inc +++ b/core/modules/user/user.admin.inc @@ -863,7 +863,7 @@ function user_admin_roles($form, $form_state) { foreach ($roles as $rid => $role) { $form['roles'][$rid]['#role'] = $role; - $form['roles'][$rid]['#weight'] = $role->weight; + $form['roles'][$rid]['#weight'] = $role->get('weight'); $form['roles'][$rid]['name'] = array( '#markup' => check_plain($role->label()), ); @@ -872,7 +872,7 @@ function user_admin_roles($form, $form_state) { '#title' => t('Weight for @title', array('@title' => $role->label())), '#title_display' => 'invisible', '#size' => 4, - '#default_value' => $role->weight, + '#default_value' => $role->get('weight'), '#attributes' => array('class' => array('role-weight')), ); $links['edit'] = array( diff --git a/core/modules/views/lib/Drupal/views/Plugin/Core/Entity/View.php b/core/modules/views/lib/Drupal/views/Plugin/Core/Entity/View.php index 8e83ea2..a6a4ecd 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/Core/Entity/View.php +++ b/core/modules/views/lib/Drupal/views/Plugin/Core/Entity/View.php @@ -54,7 +54,7 @@ class View extends ConfigEntityBase implements ViewStorageInterface { * * @var string */ - public $id = NULL; + protected $id = NULL; /** * The description of the view, which is used only in the interface. @@ -78,7 +78,7 @@ class View extends ConfigEntityBase implements ViewStorageInterface { * * @var string */ - public $human_name = ''; + protected $human_name = ''; /** * The core version the view was created for. @@ -109,7 +109,7 @@ class View extends ConfigEntityBase implements ViewStorageInterface { * * @var string */ - public $uuid = NULL; + protected $uuid = NULL; /** * Stores a reference to the executable version of this view. diff --git a/core/modules/views/views.module b/core/modules/views/views.module index f1cb911..872f57c 100644 --- a/core/modules/views/views.module +++ b/core/modules/views/views.module @@ -603,6 +603,9 @@ function views_add_contextual_links(&$render_element, $location, ViewExecutable $valid = FALSE; break; } + elseif (in_array($property, array('id', 'uuid', 'label'))) { + $args[] = $view->storage->$property(); + } else { $args[] = $view->storage->{$property}; }