diff --git a/core/modules/region/lib/Drupal/region/Plugin/Core/Entity/Region.php b/core/modules/region/lib/Drupal/region/Plugin/Core/Entity/Region.php index d883303..1e842e2 100644 --- a/core/modules/region/lib/Drupal/region/Plugin/Core/Entity/Region.php +++ b/core/modules/region/lib/Drupal/region/Plugin/Core/Entity/Region.php @@ -2,15 +2,36 @@ /** * @file - * Definition of Drupal\region\Region. + * Definition of Drupal\region\Plugin\Core\Entity\Region;. */ -namespace Drupal\region; +namespace Drupal\region\Plugin\Core\Entity; use Drupal\Core\Config\Entity\ConfigEntityBase; +use Drupal\Core\Annotation\Plugin; +use Drupal\Core\Annotation\Translation; /** - * Defines the region entity. + * Defines the region entity class. + * + * @Plugin( + * id = "region", + * label = @Translation("Region"), + * module = "region", + * controller_class = "Drupal\Core\Config\Entity\ConfigStorageController", + * form_controller_class = { + * "default" = "Drupal\region\RegionFormController", + * }, + * list_controller_class = "Drupal\Core\Config\Entity\ConfigEntityListController", + * list_path = "admin/structure/regions", + * uri_callback = "region_uri", + * config_prefix = "region", + * entity_keys = { + * "id" = "id", + * "label" = "label", + * "uuid" = "uuid", + * } + * ) */ class Region extends ConfigEntityBase { diff --git a/core/modules/region/lib/Drupal/region/RegionFormController.php b/core/modules/region/lib/Drupal/region/RegionFormController.php index a917136..06943d6 100644 --- a/core/modules/region/lib/Drupal/region/RegionFormController.php +++ b/core/modules/region/lib/Drupal/region/RegionFormController.php @@ -9,6 +9,7 @@ use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityFormController; +use Drupal\region\Plugin\Core\Entity\Region; /** * Form controller for the region edit/add forms. diff --git a/core/modules/region/lib/Drupal/region/Tests/RegionTest.php b/core/modules/region/lib/Drupal/region/Tests/RegionTest.php index 5ca0b7a..e7b32c9 100644 --- a/core/modules/region/lib/Drupal/region/Tests/RegionTest.php +++ b/core/modules/region/lib/Drupal/region/Tests/RegionTest.php @@ -32,7 +32,7 @@ public static function getInfo() { /** * Tests the default regions. */ - public function testDefaultRegions() { + function testDefaultRegions() { // Create a new user, allow him to manage the blocks and the languages. $admin_user = $this->drupalCreateUser(array( 'administer regions', @@ -69,7 +69,7 @@ public function testDefaultRegions() { /** * Tests editing a default region. */ - public function testEditDefaultRegion() { + function testEditDefaultRegion() { // Create a new user, allow him to manage the blocks and the languages. $admin_user = $this->drupalCreateUser(array( 'administer regions', @@ -90,7 +90,7 @@ public function testEditDefaultRegion() { /** * Tests deleting a default region. */ - public function testDeleteDefaultRegion() { + function testDeleteDefaultRegion() { // Create a new user, allow him to manage the blocks and the languages. $admin_user = $this->drupalCreateUser(array( 'administer regions', @@ -108,7 +108,7 @@ public function testDeleteDefaultRegion() { /** * Tests adding a new region and all actions on that. */ - public function testNewRegion() { + function testNewRegion() { // Create a new user, allow him to manage the blocks and the languages. $admin_user = $this->drupalCreateUser(array( 'administer regions', diff --git a/core/modules/region/region.admin.inc b/core/modules/region/region.admin.inc index 1429ba9..8c36b63 100644 --- a/core/modules/region/region.admin.inc +++ b/core/modules/region/region.admin.inc @@ -5,7 +5,7 @@ * Administration functions to maintain a common set of regions for layouts. */ -use Drupal\region\Region; +use Drupal\region\Plugin\Core\Entity\Region; /** * Page callback: Presents list of regions. @@ -42,7 +42,7 @@ function region_page_add() { * * @see region_menu() */ -function region_delete_confirm($form, &$form_state, Region $region) { +function region_confirm_delete($form, &$form_state, Region $region) { // Always provide entity id in the same form key as in the entity edit form. $form['id'] = array('#type' => 'value', '#value' => $region->id()); $form_state['region'] = $region; @@ -58,7 +58,7 @@ function region_delete_confirm($form, &$form_state, Region $region) { /** * Form submission handler for region_delete_confirm(). */ -function region_delete_confirm_submit($form, &$form_state) { +function region_confirm_delete_submit($form, &$form_state) { $region = $form_state['region']; $region->delete(); drupal_set_message(t('Region %label has been deleted.', array('%label' => $region->label()))); diff --git a/core/modules/region/region.info b/core/modules/region/region.info index 1a279b2..552b8f3 100644 --- a/core/modules/region/region.info +++ b/core/modules/region/region.info @@ -1,5 +1,5 @@ name = Region -description = Maintains a common set of regions available to layouts. +description = Maintains a common set of regions available to dynamic layouts. package = Core version = VERSION core = 8.x diff --git a/core/modules/region/region.module b/core/modules/region/region.module index 8bf35c7..32561e6 100644 --- a/core/modules/region/region.module +++ b/core/modules/region/region.module @@ -5,13 +5,22 @@ * Module to maintain a common set of regions for layouts. */ -use Drupal\region\Region; +use Drupal\region\Plugin\Core\Entity\Region; + +/** + * Implements hook_help(). + */ +function region_help($path, $arg) { + switch($path) { + case 'admin/help#region': + return '
' . t('Regions allow you to place blocks on pages. The region module provides management facilities for a dynamic region list useful for layout builders which allow you to dynamically edit your page layouts. It is not useful for static layouts shipped with modules and themes.') . '
'; + } +} /** * Implements hook_menu(). */ function region_menu() { - $items = array(); $items['admin/structure/regions'] = array( 'title' => 'Regions', 'description' => 'Manage list of regions that allow content to be placed.', @@ -45,7 +54,7 @@ function region_menu() { $items['admin/structure/regions/manage/%region/delete'] = array( 'title' => 'Delete', 'page callback' => 'drupal_get_form', - 'page arguments' => array('region_delete_confirm', 4), + 'page arguments' => array('region_confirm_delete', 4), 'access callback' => 'user_access', 'access arguments' => array('administer regions'), 'type' => MENU_LOCAL_TASK, @@ -67,30 +76,6 @@ function region_permission() { } /** - * Implements hook_entity_info(). - */ -function region_entity_info() { - $types['region'] = array( - 'label' => 'Region', - 'entity class' => 'Drupal\region\Region', - 'controller class' => 'Drupal\Core\Config\Entity\ConfigStorageController', - 'form controller class' => array( - 'default' => 'Drupal\region\RegionFormController', - ), - 'list controller class' => 'Drupal\Core\Config\Entity\ConfigEntityListController', - 'list path' => 'admin/structure/regions', - 'uri callback' => 'region_uri', - 'config prefix' => 'region', - 'entity keys' => array( - 'id' => 'id', - 'label' => 'label', - 'uuid' => 'uuid', - ), - ); - return $types; -} - -/** * Entity URI callback. * * @param Drupal\region\Region $region