diff --git a/core/modules/rlayout/lib/Drupal/rlayout/Plugin/Core/Entity/RLayout.php b/core/modules/rlayout/lib/Drupal/rlayout/Plugin/Core/Entity/RLayout.php index 51415db..9308403 100644 --- a/core/modules/rlayout/lib/Drupal/rlayout/Plugin/Core/Entity/RLayout.php +++ b/core/modules/rlayout/lib/Drupal/rlayout/Plugin/Core/Entity/RLayout.php @@ -2,15 +2,36 @@ /** * @file - * Definition of Drupal\rlayout\RLayout. + * Definition of Drupal\rlayout\Plugin\Core\Entity\RLayout. */ -namespace Drupal\rlayout; +namespace Drupal\rlayout\Plugin\Core\Entity; use Drupal\Core\Config\Entity\ConfigEntityBase; +use Drupal\Core\Annotation\Plugin; +use Drupal\Core\Annotation\Translation; /** - * Defines the layout entity. + * Defines the responsive layout entity class. + * + * @Plugin( + * id = "rlayout", + * label = @Translation("Responsive layout"), + * module = "rlayout", + * controller_class = "Drupal\Core\Config\Entity\ConfigStorageController", + * form_controller_class = { + * "default" = "Drupal\rlayout\RLayoutFormController", + * }, + * list_controller_class = "Drupal\Core\Config\Entity\ConfigEntityListController", + * list_path = "admin/structure/layouts", + * uri_callback = "rlayout_uri", + * config_prefix = "rlayoutset", + * entity_keys = { + * "id" = "id", + * "label" = "label", + * "uuid" = "uuid", + * } + * ) */ class RLayout extends ConfigEntityBase { diff --git a/core/modules/rlayout/lib/Drupal/rlayout/RLayoutFormController.php b/core/modules/rlayout/lib/Drupal/rlayout/RLayoutFormController.php index d109b7d..4468741 100644 --- a/core/modules/rlayout/lib/Drupal/rlayout/RLayoutFormController.php +++ b/core/modules/rlayout/lib/Drupal/rlayout/RLayoutFormController.php @@ -10,6 +10,7 @@ use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityFormController; use Drupal\region\Region; +use Drupal\rlayout\Plugin\Core\Entity\RLayout; /** * Form controller for the layout edit/add forms. diff --git a/core/modules/rlayout/rlayout.admin.inc b/core/modules/rlayout/rlayout.admin.inc index e82ce56..bf43381 100644 --- a/core/modules/rlayout/rlayout.admin.inc +++ b/core/modules/rlayout/rlayout.admin.inc @@ -5,7 +5,7 @@ * Administration functions to maintain a set of layouts. */ -use Drupal\rlayout\RLayout; +use Drupal\rlayout\Plugin\Core\Entity\RLayout; /** * Page callback: Presents list of layouts. @@ -42,7 +42,7 @@ function rlayout_page_add() { * * @see layout_menu() */ -function rlayout_delete_confirm($form, &$form_state, RLayout $layout) { +function rlayout_confirm_delete($form, &$form_state, RLayout $layout) { // Always provide entity id in the same form key as in the entity edit form. $form['id'] = array('#type' => 'value', '#value' => $layout->id()); $form_state['layout'] = $layout; @@ -56,9 +56,9 @@ function rlayout_delete_confirm($form, &$form_state, RLayout $layout) { } /** - * Form submission handler for layout_delete_confirm(). + * Form submission handler for layout_confirm_delete(). */ -function rlayout_delete_confirm_submit($form, &$form_state) { +function rlayout_confirm_delete_submit($form, &$form_state) { $layout = $form_state['layout']; $layout->delete(); drupal_set_message(t('Layout %label has been deleted.', array('%label' => $layout->label()))); diff --git a/core/modules/rlayout/rlayout.module b/core/modules/rlayout/rlayout.module index 9d2a7b4..33be207 100644 --- a/core/modules/rlayout/rlayout.module +++ b/core/modules/rlayout/rlayout.module @@ -5,13 +5,22 @@ * Responsive layout builder tool for Panels. */ -use Drupal\rlayout\RLayout; +use Drupal\rlayout\Plugin\Core\Entity\RLayout; + +/** + * Implements hook_help(). + */ +function rlayout_help($path, $arg) { + switch($path) { + case 'admin/help#rlayout': + return '

' . t('The responsive layout editor lets you create and edit dynamic layouts using a set of configurable regions, breakpoints and grids. Different layouts can be applied to different breakpoints using various grids.') . '

'; + } +} /** * Implements hook_menu(). */ function rlayout_menu() { - $items = array(); $items['admin/structure/layouts'] = array( 'title' => 'Layouts', 'description' => 'Manage list of layouts.', @@ -45,7 +54,7 @@ function rlayout_menu() { $items['admin/structure/layouts/manage/%rlayout/delete'] = array( 'title' => 'Delete', 'page callback' => 'drupal_get_form', - 'page arguments' => array('rlayout_delete_confirm', 4), + 'page arguments' => array('rlayout_confirm_delete', 4), 'access callback' => 'user_access', 'access arguments' => array('administer layouts'), 'type' => MENU_LOCAL_TASK, @@ -67,30 +76,6 @@ function rlayout_permission() { } /** - * Implements hook_entity_info(). - */ -function rlayout_entity_info() { - $types['rlayout'] = array( - 'label' => 'Responsive layout', - 'entity class' => 'Drupal\rlayout\RLayout', - 'controller class' => 'Drupal\Core\Config\Entity\ConfigStorageController', - 'form controller class' => array( - 'default' => 'Drupal\rlayout\RLayoutFormController', - ), - 'list controller class' => 'Drupal\Core\Config\Entity\ConfigEntityListController', - 'list path' => 'admin/structure/layouts', - 'uri callback' => 'rlayout_uri', - 'config prefix' => 'rlayoutset', - 'entity keys' => array( - 'id' => 'id', - 'label' => 'label', - 'uuid' => 'uuid', - ), - ); - return $types; -} - -/** * Entity URI callback. * * @param Drupal\rlayout\RLayout $layout