diff --git a/core/lib/Drupal/Core/Action/ConfigurableActionBase.php b/core/lib/Drupal/Core/Action/ConfigurableActionBase.php index 04ca4fe..fc7293a 100644 --- a/core/lib/Drupal/Core/Action/ConfigurableActionBase.php +++ b/core/lib/Drupal/Core/Action/ConfigurableActionBase.php @@ -7,13 +7,13 @@ namespace Drupal\Core\Action; -use Drupal\Core\Action\ConfigurableActionInterface; +use Drupal\Core\Plugin\ConfigurablePluginInterface; use Drupal\Core\Action\ActionBase; /** * Provides a base implementation for a configurable Action plugin. */ -abstract class ConfigurableActionBase extends ActionBase implements ConfigurableActionInterface { +abstract class ConfigurableActionBase extends ActionBase implements ConfigurablePluginInterface { /** * {@inheritdoc} diff --git a/core/lib/Drupal/Core/Action/ConfigurableActionInterface.php b/core/lib/Drupal/Core/Plugin/ConfigurablePluginInterface.php similarity index 93% rename from core/lib/Drupal/Core/Action/ConfigurableActionInterface.php rename to core/lib/Drupal/Core/Plugin/ConfigurablePluginInterface.php index c0a66a9..1bb335f 100644 --- a/core/lib/Drupal/Core/Action/ConfigurableActionInterface.php +++ b/core/lib/Drupal/Core/Plugin/ConfigurablePluginInterface.php @@ -5,7 +5,7 @@ * Contains \Drupal\Core\Action\ConfigurableActionInterface. */ -namespace Drupal\Core\Action; +namespace Drupal\Core\Plugin; use Drupal\Core\Action\ActionInterface; @@ -15,7 +15,7 @@ * @see \Drupal\Core\Annotation\Operation * @see \Drupal\Core\Action\OperationManager */ -interface ConfigurableActionInterface extends ActionInterface { +interface ConfigurablePluginInterface { /** * Returns this plugin's configuration. diff --git a/core/lib/Drupal/Core/Action/ActionBag.php b/core/lib/Drupal/Core/Plugin/DefaultPluginBag.php similarity index 70% rename from core/lib/Drupal/Core/Action/ActionBag.php rename to core/lib/Drupal/Core/Plugin/DefaultPluginBag.php index a8210fe..e20a89a 100644 --- a/core/lib/Drupal/Core/Action/ActionBag.php +++ b/core/lib/Drupal/Core/Plugin/DefaultPluginBag.php @@ -2,18 +2,18 @@ /** * @file - * Contains \Drupal\Core\Action\ActionBag. + * Contains \Drupal\Core\Plugin\DefaultPluginBag. */ -namespace Drupal\Core\Action; +namespace Drupal\Core\Plugin; use Drupal\Component\Plugin\PluginBag; use Drupal\Component\Plugin\PluginManagerInterface; /** - * Provides a container for lazily loading Action plugins. + * @todo. */ -class ActionBag extends PluginBag { +class DefaultPluginBag extends PluginBag { /** * The manager used to instantiate the plugins. @@ -23,7 +23,7 @@ class ActionBag extends PluginBag { protected $manager; /** - * Constructs a new ActionBag object. + * Constructs a new DefaultPluginBag object. * * @param \Drupal\Component\Plugin\PluginManagerInterface $manager * The manager to be used for instantiating plugins. @@ -42,11 +42,9 @@ public function __construct(PluginManagerInterface $manager, array $instance_ids * {@inheritdoc} */ protected function initializePlugin($instance_id) { - if (isset($this->pluginInstances[$instance_id])) { - return; + if (!isset($this->pluginInstances[$instance_id])) { + $this->pluginInstances[$instance_id] = $this->manager->createInstance($instance_id, $this->configuration); } - - $this->pluginInstances[$instance_id] = $this->manager->createInstance($instance_id, $this->configuration); } } diff --git a/core/modules/action/lib/Drupal/action/ActionFormControllerBase.php b/core/modules/action/lib/Drupal/action/ActionFormControllerBase.php index ff48164..7163b9e 100644 --- a/core/modules/action/lib/Drupal/action/ActionFormControllerBase.php +++ b/core/modules/action/lib/Drupal/action/ActionFormControllerBase.php @@ -10,7 +10,7 @@ use Drupal\Core\Entity\EntityControllerInterface; use Drupal\Core\Entity\EntityFormController; use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Action\ConfigurableActionInterface; +use Drupal\Core\Plugin\ConfigurablePluginInterface; use Drupal\Core\Entity\EntityStorageControllerInterface; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -97,7 +97,7 @@ public function form(array $form, array &$form_state) { '#value' => $this->entity->getType(), ); - if ($this->plugin instanceof ConfigurableActionInterface) { + if ($this->plugin instanceof ConfigurablePluginInterface) { $form += $this->plugin->form($form, $form_state); } @@ -133,7 +133,7 @@ protected function actions(array $form, array &$form_state) { public function validate(array $form, array &$form_state) { parent::validate($form, $form_state); - if ($this->plugin instanceof ConfigurableActionInterface) { + if ($this->plugin instanceof ConfigurablePluginInterface) { $this->plugin->validate($form, $form_state); } } @@ -144,7 +144,7 @@ public function validate(array $form, array &$form_state) { public function submit(array $form, array &$form_state) { parent::submit($form, $form_state); - if ($this->plugin instanceof ConfigurableActionInterface) { + if ($this->plugin instanceof ConfigurablePluginInterface) { $this->plugin->submit($form, $form_state); } return $this->entity; diff --git a/core/modules/action/lib/Drupal/action/Form/ActionAdminManageForm.php b/core/modules/action/lib/Drupal/action/Form/ActionAdminManageForm.php index d0244b1..3fbdda7 100644 --- a/core/modules/action/lib/Drupal/action/Form/ActionAdminManageForm.php +++ b/core/modules/action/lib/Drupal/action/Form/ActionAdminManageForm.php @@ -57,7 +57,7 @@ public function getFormID() { public function buildForm(array $form, array &$form_state) { $actions = array(); foreach ($this->manager->getDefinitions() as $id => $definition) { - if (is_subclass_of($definition['class'], '\Drupal\Core\Action\ConfigurableActionInterface')) { + if (is_subclass_of($definition['class'], '\Drupal\Core\Plugin\ConfigurablePluginInterface')) { $key = Crypt::hashBase64($id); $actions[$key] = $definition['label'] . '...'; } diff --git a/core/modules/node/lib/Drupal/node/Plugin/Search/NodeSearch.php b/core/modules/node/lib/Drupal/node/Plugin/Search/NodeSearch.php index 30d44cb..a5c6318 100644 --- a/core/modules/node/lib/Drupal/node/Plugin/Search/NodeSearch.php +++ b/core/modules/node/lib/Drupal/node/Plugin/Search/NodeSearch.php @@ -14,9 +14,8 @@ use Drupal\Core\Entity\EntityManager; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\KeyValueStore\KeyValueStoreInterface; -use Drupal\search\Plugin\SearchPluginBase; +use Drupal\search\Plugin\ConfigurableSearchPluginBase; use Drupal\search\Annotation\SearchPlugin; - use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -28,7 +27,7 @@ * path = "node" * ) */ -class NodeSearch extends SearchPluginBase { +class NodeSearch extends ConfigurableSearchPluginBase { /** * A database connection object. @@ -298,7 +297,7 @@ public function indexStatus() { /** * {@inheritdoc} */ - public function addToAdminForm(array &$form, array &$form_state) { + public function form(array $form, array &$form_state) { // Output form for defining rank factor weights. $form['content_ranking'] = array( '#type' => 'details', @@ -319,17 +318,17 @@ public function addToAdminForm(array &$form, array &$form_state) { '#default_value' => variable_get('node_rank_' . $var, 0), ); } + return $form; } /** * {@inheritdoc} */ - public function submitAdminForm(array &$form, array &$form_state) { + public function submit(array &$form, array &$form_state) { foreach ($this->moduleHandler->invokeAll('ranking') as $var => $values) { if (isset($form_state['values']['node_rank_' . $var])) { variable_set('node_rank_' . $var, $form_state['values']['node_rank_' . $var]); } } } - } diff --git a/core/modules/search/lib/Drupal/search/Controller/SearchController.php b/core/modules/search/lib/Drupal/search/Controller/SearchController.php new file mode 100644 index 0000000..e052183 --- /dev/null +++ b/core/modules/search/lib/Drupal/search/Controller/SearchController.php @@ -0,0 +1,61 @@ +searchManager = $search_manager; + } + + /** + * {@inheritdoc} + */ + public static function create(ContainerInterface $container) { + return new static( + $container->get('plugin.manager.search') + ); + } + + public function addSearchConfig() { + drupal_set_title(t('Add new search configuration')); + $search_types = array(); + foreach ($this->searchManager->getDefinitions() as $plugin_id => $search_info) { + $search_types[$plugin_id] = array( + 'title' => $search_info['title'], + 'href' => 'admin/config/search/add/' . $plugin_id, + 'localized_options' => array(), + ); + } + return array( + '#theme' => 'admin_block_content', + '#content' => $search_types, + ); + } + +} diff --git a/core/modules/search/lib/Drupal/search/Form/SearchAddForm.php b/core/modules/search/lib/Drupal/search/Form/SearchAddForm.php new file mode 100644 index 0000000..60a1727 --- /dev/null +++ b/core/modules/search/lib/Drupal/search/Form/SearchAddForm.php @@ -0,0 +1,31 @@ +entity->setPlugin($search_plugin_id); + return parent::buildForm($form, $form_state); + } + +} diff --git a/core/modules/search/lib/Drupal/search/Form/SearchEditForm.php b/core/modules/search/lib/Drupal/search/Form/SearchEditForm.php new file mode 100644 index 0000000..34c8bef --- /dev/null +++ b/core/modules/search/lib/Drupal/search/Form/SearchEditForm.php @@ -0,0 +1,23 @@ + $this->entity->label()))); + parent::init($form_state); + } + +} diff --git a/core/modules/action/lib/Drupal/action/ActionFormControllerBase.php b/core/modules/search/lib/Drupal/search/Form/SearchFormBase.php similarity index 71% copy from core/modules/action/lib/Drupal/action/ActionFormControllerBase.php copy to core/modules/search/lib/Drupal/search/Form/SearchFormBase.php index ff48164..571da8c 100644 --- a/core/modules/action/lib/Drupal/action/ActionFormControllerBase.php +++ b/core/modules/search/lib/Drupal/search/Form/SearchFormBase.php @@ -2,44 +2,51 @@ /** * @file - * Contains Drupal\action\ActionEditFormController. + * Contains \Drupal\search\Form\SearchFormBase. */ -namespace Drupal\action; +namespace Drupal\search\Form; use Drupal\Core\Entity\EntityControllerInterface; use Drupal\Core\Entity\EntityFormController; -use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Action\ConfigurableActionInterface; use Drupal\Core\Entity\EntityStorageControllerInterface; +use Drupal\Core\Extension\ModuleHandlerInterface; +use Drupal\Core\Plugin\ConfigurablePluginInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** - * Provides a base form controller for action forms. + * @todo. */ -abstract class ActionFormControllerBase extends EntityFormController implements EntityControllerInterface { +abstract class SearchFormBase extends EntityFormController implements EntityControllerInterface { /** - * The action plugin being configured. + * The entity being used by this form. + * + * @var \Drupal\search\SearchInterface + */ + protected $entity; + + /** + * The search plugin being configured. * * @var \Drupal\Core\Action\ActionInterface */ protected $plugin; /** - * The action storage controller. + * The search storage controller. * * @var \Drupal\Core\Entity\EntityStorageControllerInterface */ protected $storageController; /** - * Constructs a new action form. + * Constructs a new search form. * * @param \Drupal\Core\Extension\ModuleHandlerInterface * The module handler service. * @param \Drupal\Core\Entity\EntityStorageControllerInterface $storage_controller - * The action storage controller. + * The search storage controller. */ public function __construct(ModuleHandlerInterface $module_handler, EntityStorageControllerInterface $storage_controller) { parent::__construct($module_handler); @@ -74,16 +81,13 @@ public function form(array $form, array &$form_state) { '#title' => t('Label'), '#default_value' => $this->entity->label(), '#maxlength' => '255', - '#description' => t('A unique label for this advanced action. This label will be displayed in the interface of modules that integrate with actions.'), ); $form['id'] = array( '#type' => 'machine_name', - '#title' => t('Machine name'), '#default_value' => $this->entity->id(), '#disabled' => !$this->entity->isNew(), '#maxlength' => 64, - '#description' => t('A unique name for this action. It must only contain lowercase letters, numbers and underscores.'), '#machine_name' => array( 'exists' => array($this, 'exists'), ), @@ -97,7 +101,7 @@ public function form(array $form, array &$form_state) { '#value' => $this->entity->getType(), ); - if ($this->plugin instanceof ConfigurableActionInterface) { + if ($this->plugin instanceof ConfigurablePluginInterface) { $form += $this->plugin->form($form, $form_state); } @@ -105,17 +109,17 @@ public function form(array $form, array &$form_state) { } /** - * Determines if the action already exists. + * Determines if the search entity already exists. * * @param string $id - * The action ID + * The search configuration ID. * * @return bool - * TRUE if the action exists, FALSE otherwise. + * TRUE if the search configuration exists, FALSE otherwise. */ public function exists($id) { - $action = $this->storageController->load($id); - return !empty($action); + $search = $this->storageController->load($id); + return !empty($search); } /** @@ -133,7 +137,7 @@ protected function actions(array $form, array &$form_state) { public function validate(array $form, array &$form_state) { parent::validate($form, $form_state); - if ($this->plugin instanceof ConfigurableActionInterface) { + if ($this->plugin instanceof ConfigurablePluginInterface) { $this->plugin->validate($form, $form_state); } } @@ -144,7 +148,7 @@ public function validate(array $form, array &$form_state) { public function submit(array $form, array &$form_state) { parent::submit($form, $form_state); - if ($this->plugin instanceof ConfigurableActionInterface) { + if ($this->plugin instanceof ConfigurablePluginInterface) { $this->plugin->submit($form, $form_state); } return $this->entity; @@ -155,9 +159,9 @@ public function submit(array $form, array &$form_state) { */ public function save(array $form, array &$form_state) { $this->entity->save(); - drupal_set_message(t('The action has been successfully saved.')); + drupal_set_message(t('The search has been successfully saved.')); - $form_state['redirect'] = 'admin/config/system/actions'; + $form_state['redirect'] = 'admin/config/search/list'; } } diff --git a/core/modules/search/lib/Drupal/search/Form/SearchSettingsForm.php b/core/modules/search/lib/Drupal/search/Form/SearchSettingsForm.php index 40d2e1f..b4e6456 100644 --- a/core/modules/search/lib/Drupal/search/Form/SearchSettingsForm.php +++ b/core/modules/search/lib/Drupal/search/Form/SearchSettingsForm.php @@ -191,10 +191,6 @@ public function buildForm(array $form, array &$form_state) { '#description' => t('Choose which search module is the default.') ); - // Per module plugin settings - foreach ($active_plugins as $plugin) { - $plugin->addToAdminForm($form, $form_state); - } // Set #submit so we are sure it's invoked even if one of // the active search modules added its own #submit. $form['#submit'][] = array($this, 'submitForm'); diff --git a/core/lib/Drupal/Core/Action/ConfigurableActionBase.php b/core/modules/search/lib/Drupal/search/Plugin/ConfigurableSearchPluginBase.php similarity index 61% copy from core/lib/Drupal/Core/Action/ConfigurableActionBase.php copy to core/modules/search/lib/Drupal/search/Plugin/ConfigurableSearchPluginBase.php index 04ca4fe..d41836a 100644 --- a/core/lib/Drupal/Core/Action/ConfigurableActionBase.php +++ b/core/modules/search/lib/Drupal/search/Plugin/ConfigurableSearchPluginBase.php @@ -2,18 +2,17 @@ /** * @file - * Contains \Drupal\Core\Action\ConfigurableActionBase. + * Contains \Drupal\search\Plugin\ConfigurableSearchPluginBase. */ -namespace Drupal\Core\Action; +namespace Drupal\search\Plugin; -use Drupal\Core\Action\ConfigurableActionInterface; -use Drupal\Core\Action\ActionBase; +use Drupal\Core\Plugin\ConfigurablePluginInterface; /** - * Provides a base implementation for a configurable Action plugin. + * @todo. */ -abstract class ConfigurableActionBase extends ActionBase implements ConfigurableActionInterface { +abstract class ConfigurableSearchPluginBase extends SearchPluginBase implements ConfigurablePluginInterface { /** * {@inheritdoc} @@ -25,7 +24,7 @@ public function __construct(array $configuration, $plugin_id, array $plugin_defi } /** - * Returns default configuration for this action. + * Returns default configuration for this search plugin. * * @return array */ diff --git a/core/modules/system/lib/Drupal/system/Plugin/Core/Entity/Action.php b/core/modules/search/lib/Drupal/search/Plugin/Core/Entity/Search.php similarity index 63% copy from core/modules/system/lib/Drupal/system/Plugin/Core/Entity/Action.php copy to core/modules/search/lib/Drupal/search/Plugin/Core/Entity/Search.php index fe8f537..40ba349 100644 --- a/core/modules/system/lib/Drupal/system/Plugin/Core/Entity/Action.php +++ b/core/modules/search/lib/Drupal/search/Plugin/Core/Entity/Search.php @@ -2,31 +2,34 @@ /** * @file - * Contains \Drupal\system\Plugin\Core\Entity\Action. + * Contains \Drupal\search\Plugin\Core\Entity\Search. */ -namespace Drupal\system\Plugin\Core\Entity; +namespace Drupal\search\Plugin\Core\Entity; +use Drupal\Core\Annotation\Translation; use Drupal\Core\Config\Entity\ConfigEntityBase; use Drupal\Core\Entity\Annotation\EntityType; -use Drupal\Core\Annotation\Translation; use Drupal\Core\Entity\EntityStorageControllerInterface; -use Drupal\system\ActionConfigEntityInterface; -use Drupal\Core\Action\ActionBag; -use Drupal\Core\Action\ConfigurableActionInterface; +use Drupal\Core\Plugin\ConfigurablePluginInterface; +use Drupal\Core\Plugin\DefaultPluginBag; +use Drupal\search\SearchInterface; /** - * Defines the configured action entity. + * @todo. * * @EntityType( - * id = "action", - * label = @Translation("Action"), - * module = "system", + * id = "search", + * label = @Translation("Search"), * controllers = { * "storage" = "Drupal\Core\Config\Entity\ConfigStorageController", - * "access" = "Drupal\action\ActionAccessController" + * "list" = "Drupal\search\SearchListController", + * "form" = { + * "add" = "Drupal\search\Form\SearchAddForm", + * "edit" = "Drupal\search\Form\SearchEditForm" + * } * }, - * config_prefix = "action.action", + * config_prefix = "search.search", * entity_keys = { * "id" = "id", * "label" = "label", @@ -34,54 +37,54 @@ * } * ) */ -class Action extends ConfigEntityBase implements ActionConfigEntityInterface { +class Search extends ConfigEntityBase implements SearchInterface { /** - * The name (plugin ID) of the action. + * The name (plugin ID) of the search entity. * * @var string */ public $id; /** - * The label of the action. + * The label of the search entity. * * @var string */ public $label; /** - * The UUID of the action. + * The UUID of the search entity. * * @var string */ public $uuid; /** - * The action type. + * The search entity type. * * @var string */ protected $type; /** - * The configuration of the action. + * The configuration of the search entity. * * @var array */ protected $configuration = array(); /** - * The plugin ID of the action. + * The search plugin ID. * * @var string */ protected $plugin; /** - * The plugin bag that stores action plugins. + * The plugin bag that stores search plugins. * - * @var \Drupal\Core\Action\ActionBag + * @var \Drupal\Core\Plugin\DefaultPluginBag */ protected $pluginBag; @@ -91,7 +94,7 @@ class Action extends ConfigEntityBase implements ActionConfigEntityInterface { public function __construct(array $values, $entity_type) { parent::__construct($values, $entity_type); - $this->pluginBag = new ActionBag(\Drupal::service('plugin.manager.action'), array($this->plugin), $this->configuration); + $this->pluginBag = new DefaultPluginBag(\Drupal::service('plugin.manager.search'), array($this->plugin), $this->configuration); } /** @@ -127,7 +130,7 @@ public function execute(array $entities) { * {@inheritdoc} */ public function isConfigurable() { - return $this->getPlugin() instanceof ConfigurableActionInterface; + return $this->getPlugin() instanceof ConfigurablePluginInterface; } /** @@ -142,7 +145,7 @@ public function getType() { */ public function uri() { return array( - 'path' => 'admin/config/system/actions/configure/' . $this->id(), + 'path' => 'admin/config/search/manage/' . $this->id(), 'options' => array( 'entity_type' => $this->entityType, 'entity' => $this, @@ -153,22 +156,9 @@ public function uri() { /** * {@inheritdoc} */ - public static function sort($a, $b) { - $a_type = $a->getType(); - $b_type = $b->getType(); - if ($a_type != $b_type) { - return strnatcasecmp($a_type, $b_type); - } - return parent::sort($a, $b); - } - - /** - * {@inheritdoc} - */ public function getExportProperties() { $properties = parent::getExportProperties(); $names = array( - 'type', 'plugin', 'configuration', ); @@ -178,13 +168,13 @@ public function getExportProperties() { return $properties; } - /** + /** * {@inheritdoc} */ public function preSave(EntityStorageControllerInterface $storage_controller) { $plugin = $this->getPlugin(); // If this plugin has any configuration, ensure that it is set. - if ($plugin instanceof ConfigurableActionInterface) { + if ($plugin instanceof ConfigurablePluginInterface) { $this->set('configuration', $plugin->getConfiguration()); } } diff --git a/core/modules/search/lib/Drupal/search/Plugin/Menu/LocalAction/SearchAddLocalAction.php b/core/modules/search/lib/Drupal/search/Plugin/Menu/LocalAction/SearchAddLocalAction.php new file mode 100644 index 0000000..d5ee2d8 --- /dev/null +++ b/core/modules/search/lib/Drupal/search/Plugin/Menu/LocalAction/SearchAddLocalAction.php @@ -0,0 +1,24 @@ + 0, 'total' => 0); } - /** - * {@inheritdoc} - */ - public function addToAdminForm(array &$form, array &$form_state) { - // Empty default implementation. - } - - /** - * {@inheritdoc} - */ - public function submitAdminForm(array &$form, array &$form_state) { - // Empty default implementation. - } - } diff --git a/core/modules/search/lib/Drupal/search/SearchAccessController.php b/core/modules/search/lib/Drupal/search/SearchAccessController.php new file mode 100644 index 0000000..8a009c4 --- /dev/null +++ b/core/modules/search/lib/Drupal/search/SearchAccessController.php @@ -0,0 +1,27 @@ +getPlugin()->getPluginDefinition(); + $row['id'] = $definition['title']; + return $row; + } + +} diff --git a/core/modules/search/search.module b/core/modules/search/search.module index c6aef5b..2fa7591 100644 --- a/core/modules/search/search.module +++ b/core/modules/search/search.module @@ -157,6 +157,18 @@ function search_menu() { 'type' => MENU_SUGGESTED_ITEM, 'file' => 'search.pages.inc', ); + $items['admin/config/search/list'] = array( + 'title' => 'Search configuration', + 'type' => MENU_VISIBLE_IN_BREADCRUMB, + 'route_name' => 'search.list', + ); + $items['admin/config/search/add'] = array( + 'type' => MENU_VISIBLE_IN_BREADCRUMB, + 'route_name' => 'search.add', + ); + $items['admin/config/search/add/%'] = array( + 'route_name' => 'search.add_config', + ); $items['admin/config/search/settings'] = array( 'title' => 'Search settings', 'description' => 'Configure relevance settings for search and other indexing options.', diff --git a/core/modules/search/search.routing.yml b/core/modules/search/search.routing.yml index 8acf650..6f93093 100644 --- a/core/modules/search/search.routing.yml +++ b/core/modules/search/search.routing.yml @@ -10,3 +10,31 @@ search_reindex_confirm: _form: 'Drupal\search\Form\ReindexConfirm' requirements: _permission: 'administer search' + +search.add: + pattern: '/admin/config/search/add' + defaults: + _content: '\Drupal\search\Controller\SearchController::addSearchConfig' + requirements: + _permission: 'administer search' + +search.add_config: + pattern: '/admin/config/search/add/{search_plugin_id}' + defaults: + _entity_form: 'search.add' + requirements: + _entity_create_access: 'search' + +search.edit: + pattern: '/admin/config/search/manage/{search}' + defaults: + _entity_form: 'search.edit' + requirements: + _entity_access: 'search.update' + +search.list: + pattern: '/admin/config/search/list' + defaults: + _entity_list: 'search' + requirements: + _permission: 'administer search' diff --git a/core/modules/search/tests/modules/search_extra_type/lib/Drupal/search_extra_type/Plugin/Search/SearchExtraTypeSearch.php b/core/modules/search/tests/modules/search_extra_type/lib/Drupal/search_extra_type/Plugin/Search/SearchExtraTypeSearch.php index 780783c..b358ef3 100644 --- a/core/modules/search/tests/modules/search_extra_type/lib/Drupal/search_extra_type/Plugin/Search/SearchExtraTypeSearch.php +++ b/core/modules/search/tests/modules/search_extra_type/lib/Drupal/search_extra_type/Plugin/Search/SearchExtraTypeSearch.php @@ -8,7 +8,7 @@ namespace Drupal\search_extra_type\Plugin\Search; use Drupal\Core\Config\Config; -use Drupal\search\Plugin\SearchPluginBase; +use Drupal\search\Plugin\ConfigurableSearchPluginBase; use Drupal\search\Annotation\SearchPlugin; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -21,7 +21,7 @@ * path = "dummy_path" * ) */ -class SearchExtraTypeSearch extends SearchPluginBase { +class SearchExtraTypeSearch extends ConfigurableSearchPluginBase { /** * @var \Drupal\Core\Config\Config @@ -111,7 +111,7 @@ public function buildResults() { /** * {@inheritdoc} */ - public function addToAdminForm(array &$form, array &$form_state) { + public function form(array $form, array &$form_state) { // Output form for defining rank factor weights. $form['extra_type_settings'] = array( '#type' => 'fieldset', @@ -128,12 +128,13 @@ public function addToAdminForm(array &$form, array &$form_state) { ), '#default_value' => $this->configSettings->get('boost'), ); + return $form; } /** * {@inheritdoc} */ - public function submitAdminForm(array &$form, array &$form_state) { + public function submit(array &$form, array &$form_state) { $this->configSettings ->set('boost', $form_state['values']['extra_type_settings']['boost']) ->save(); diff --git a/core/modules/system/lib/Drupal/system/Plugin/Core/Entity/Action.php b/core/modules/system/lib/Drupal/system/Plugin/Core/Entity/Action.php index fe8f537..810f68b 100644 --- a/core/modules/system/lib/Drupal/system/Plugin/Core/Entity/Action.php +++ b/core/modules/system/lib/Drupal/system/Plugin/Core/Entity/Action.php @@ -11,9 +11,9 @@ use Drupal\Core\Entity\Annotation\EntityType; use Drupal\Core\Annotation\Translation; use Drupal\Core\Entity\EntityStorageControllerInterface; +use Drupal\Core\Plugin\DefaultPluginBag; use Drupal\system\ActionConfigEntityInterface; -use Drupal\Core\Action\ActionBag; -use Drupal\Core\Action\ConfigurableActionInterface; +use Drupal\Core\Plugin\ConfigurablePluginInterface; /** * Defines the configured action entity. @@ -81,7 +81,7 @@ class Action extends ConfigEntityBase implements ActionConfigEntityInterface { /** * The plugin bag that stores action plugins. * - * @var \Drupal\Core\Action\ActionBag + * @var \Drupal\Core\Plugin\DefaultPluginBag */ protected $pluginBag; @@ -91,7 +91,7 @@ class Action extends ConfigEntityBase implements ActionConfigEntityInterface { public function __construct(array $values, $entity_type) { parent::__construct($values, $entity_type); - $this->pluginBag = new ActionBag(\Drupal::service('plugin.manager.action'), array($this->plugin), $this->configuration); + $this->pluginBag = new DefaultPluginBag(\Drupal::service('plugin.manager.action'), array($this->plugin), $this->configuration); } /** @@ -127,7 +127,7 @@ public function execute(array $entities) { * {@inheritdoc} */ public function isConfigurable() { - return $this->getPlugin() instanceof ConfigurableActionInterface; + return $this->getPlugin() instanceof ConfigurablePluginInterface; } /** @@ -184,7 +184,7 @@ public function getExportProperties() { public function preSave(EntityStorageControllerInterface $storage_controller) { $plugin = $this->getPlugin(); // If this plugin has any configuration, ensure that it is set. - if ($plugin instanceof ConfigurableActionInterface) { + if ($plugin instanceof ConfigurablePluginInterface) { $this->set('configuration', $plugin->getConfiguration()); } }