diff --git a/core/modules/page/lib/Drupal/page/PageFormController.php b/core/modules/page/lib/Drupal/page/PageFormController.php index 69bdc27..d86404a 100644 --- a/core/modules/page/lib/Drupal/page/PageFormController.php +++ b/core/modules/page/lib/Drupal/page/PageFormController.php @@ -9,6 +9,7 @@ use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityFormController; +use Drupal\page\Plugin\Core\Entity\Page; /** * Form controller for the page edit/add forms. diff --git a/core/modules/page/lib/Drupal/page/PageListController.php b/core/modules/page/lib/Drupal/page/PageListController.php index c3e14d9..97c0955 100644 --- a/core/modules/page/lib/Drupal/page/PageListController.php +++ b/core/modules/page/lib/Drupal/page/PageListController.php @@ -10,6 +10,7 @@ use Drupal\Core\Config\Entity\ConfigEntityListController; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityStorageControllerInterface; +use Drupal\page\Plugin\Core\Entity\Page; /** * Provides a listing of pages. diff --git a/core/modules/page/lib/Drupal/page/Plugin/Core/Entity/Page.php b/core/modules/page/lib/Drupal/page/Plugin/Core/Entity/Page.php index bfd835c..9627354 100644 --- a/core/modules/page/lib/Drupal/page/Plugin/Core/Entity/Page.php +++ b/core/modules/page/lib/Drupal/page/Plugin/Core/Entity/Page.php @@ -2,15 +2,37 @@ /** * @file - * Definition of Drupal\page\Page. + * Definition of Drupal\page\Plugin\Core\Entity\Page. */ -namespace Drupal\page; +namespace Drupal\page\Plugin\Core\Entity; use Drupal\Core\Config\Entity\ConfigEntityBase; +use Drupal\Core\Annotation\Plugin; +use Drupal\Core\Annotation\Translation; + /** - * Defines the page entity. + * Defines the page entity class. + * + * @Plugin( + * id = "page", + * label = @Translation("Page"), + * module = "page", + * controller_class = "Drupal\Core\Config\Entity\ConfigStorageController", + * form_controller_class = { + * "default" = "Drupal\page\PageFormController", + * }, + * list_controller_class = "Drupal\page\PageListController", + * list_path = "admin/structure/pages", + * uri_callback = "page_uri", + * config_prefix = "page", + * entity_keys = { + * "id" = "id", + * "label" = "label", + * "uuid" = "uuid", + * } + * ) */ class Page extends ConfigEntityBase { diff --git a/core/modules/page/page.admin.inc b/core/modules/page/page.admin.inc index 5ac414d..1cb4b61 100644 --- a/core/modules/page/page.admin.inc +++ b/core/modules/page/page.admin.inc @@ -5,7 +5,7 @@ * Administration functions to maintain a set of pages using layouts. */ -use Drupal\page\Page; +use Drupal\page\Plugin\Core\Entity\Page; /** * Page callback: Presents list of pages. @@ -58,7 +58,7 @@ function page_page_add() { * * @see page_menu() */ -function page_delete_confirm($form, &$form_state, Page $page) { +function page_confirm_delete($form, &$form_state, Page $page) { // Always provide entity id in the same form key as in the entity edit form. $form['id'] = array('#type' => 'value', '#value' => $page->id()); $form_state['page'] = $page; @@ -72,9 +72,9 @@ function page_delete_confirm($form, &$form_state, Page $page) { } /** - * Form submission handler for page_delete_confirm(). + * Form submission handler for page_confirm_delete(). */ -function page_delete_confirm_submit($form, &$form_state) { +function page_confirm_delete_submit($form, &$form_state) { $page = $form_state['page']; $page->delete(); drupal_set_message(t('Page %label has been deleted.', array('%label' => $page->label()))); diff --git a/core/modules/page/page.module b/core/modules/page/page.module index 695e493..8890554 100644 --- a/core/modules/page/page.module +++ b/core/modules/page/page.module @@ -5,13 +5,22 @@ * Module to maintain a set of pages using layouts. */ -use Drupal\page\Page; +use Drupal\page\Plugin\Core\Entity\Page; + +/** + * Implements hook_help(). + */ +function page_help($path, $arg) { + switch($path) { + case 'admin/help#page': + return '

' . t('The page library lets you assign layouts to page patterns. Layouts are either provided by themes or modules.') . '

'; + } +} /** * Implements hook_menu(). */ function page_menu() { - $items = array(); $items['admin/structure/pages'] = array( 'title' => 'Page library', 'description' => 'Manage pages using layouts that allow content to be placed.', @@ -45,7 +54,7 @@ function page_menu() { $items['admin/structure/pages/manage/%page/delete'] = array( 'title' => 'Delete', 'page callback' => 'drupal_get_form', - 'page arguments' => array('page_delete_confirm', 4), + 'page arguments' => array('page_confirm_delete', 4), 'access callback' => 'user_access', 'access arguments' => array('administer pages'), 'type' => MENU_LOCAL_TASK, @@ -105,30 +114,6 @@ function page_get_matched_page() { } /** - * Implements hook_entity_info(). - */ -function page_entity_info() { - $types['page'] = array( - 'label' => 'Page', - 'entity class' => 'Drupal\page\Page', - 'controller class' => 'Drupal\Core\Config\Entity\ConfigStorageController', - 'form controller class' => array( - 'default' => 'Drupal\page\PageFormController', - ), - 'list controller class' => 'Drupal\page\PageListController', - 'list path' => 'admin/structure/pages', - 'uri callback' => 'page_uri', - 'config prefix' => 'page', - 'entity keys' => array( - 'id' => 'id', - 'label' => 'label', - 'uuid' => 'uuid', - ), - ); - return $types; -} - -/** * Entity URI callback. * * @param Drupal\page\Page $page