diff --git a/core/lib/Drupal/Component/Plugin/CategorizingPluginManagerInterface.php b/core/lib/Drupal/Component/Plugin/CategorizingPluginManagerInterface.php index 2a3afab..01f7eaf 100644 --- a/core/lib/Drupal/Component/Plugin/CategorizingPluginManagerInterface.php +++ b/core/lib/Drupal/Component/Plugin/CategorizingPluginManagerInterface.php @@ -23,7 +23,7 @@ public function getCategories(); /** * Gets sorted definitions. * - * @param array $definitions + * @param array[]|null $definitions * (optional) The definitions to sort. If omitted, all definitions are used. * * @return array[] @@ -34,13 +34,13 @@ public function getSortedDefinitions(array $definitions = NULL); /** * Gets definitions grouped by category. * - * @param array $definitions + * @param array[]|null $definitions * (optional) The definitions to group. If omitted, all definitions are * used. * * @return array[] - * A nested array containing plugin definitions, keyed by category and - * plugin id. + * Keys are category names, and values are arrays of which the keys are + * plugin IDs and the values are plugin definitions. */ public function getGroupedDefinitions(array $definitions = NULL); diff --git a/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php b/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php index f6f283e..4450deb 100644 --- a/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php +++ b/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php @@ -69,9 +69,10 @@ protected function getModuleName($module) { } /** - * See \Drupal\Component\Plugin\CategorizingPluginManagerInterface::getCategories(). + * Implements \Drupal\Component\Plugin\CategorizingPluginManagerInterface::getCategories(). */ public function getCategories() { + /** @var \Drupal\Core\Plugin\CategorizingPluginManagerTrait|\Drupal\Component\Plugin\PluginManagerInterface $this */ $categories = array_unique(array_values(array_map(function ($definition) { return $definition['category']; }, $this->getDefinitions()))); @@ -80,14 +81,11 @@ public function getCategories() { } /** - * See \Drupal\Component\Plugin\CategorizingPluginManagerInterface::getSortedDefinitions(). - * - * @param string $label_key - * (optional) The key used for the label in plugin definitions. Defaults to - * label. + * Implements \Drupal\Component\Plugin\CategorizingPluginManagerInterface::getSortedDefinitions(). */ public function getSortedDefinitions(array $definitions = NULL, $label_key = 'label') { // Sort the plugins first by category, then by label. + /** @var \Drupal\Core\Plugin\CategorizingPluginManagerTrait|\Drupal\Component\Plugin\PluginManagerInterface $this */ $definitions = isset($definitions) ? $definitions : $this->getDefinitions(); uasort($definitions, function ($a, $b) use ($label_key) { if ($a['category'] != $b['category']) { @@ -99,9 +97,10 @@ public function getSortedDefinitions(array $definitions = NULL, $label_key = 'la } /** - * See \Drupal\Component\Plugin\CategorizingPluginManagerInterface::getGroupedDefinitions(). + * Implements \Drupal\Component\Plugin\CategorizingPluginManagerInterface::getGroupedDefinitions(). */ public function getGroupedDefinitions(array $definitions = NULL) { + /** @var \Drupal\Core\Plugin\CategorizingPluginManagerTrait|\Drupal\Component\Plugin\PluginManagerInterface $this */ $definitions = isset($definitions) ? $definitions : $this->getDefinitions(); $grouped_definitions = array(); foreach ($definitions as $id => $definition) {