You are here

public function Manager::getDefinitions in Field Permissions 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/FieldPermissionType/Manager.php \Drupal\field_permissions\Plugin\FieldPermissionType\Manager::getDefinitions()

Gets the definition of all plugins for this type.

Return value

mixed[] An array of plugin definitions (empty array if no definitions were found). Keys are plugin IDs.

Overrides DefaultPluginManager::getDefinitions

See also

\Drupal\Core\Plugin\FilteredPluginManagerInterface::getFilteredDefinitions()

File

src/Plugin/FieldPermissionType/Manager.php, line 67

Class

Manager
Field permission type plugin manager.

Namespace

Drupal\field_permissions\Plugin\FieldPermissionType

Code

public function getDefinitions() {
  $definitions = parent::getDefinitions();

  // Order by weight.
  uasort($definitions, function ($a, $b) {
    if ($a['weight'] == $b['weight']) {
      return 0;
    }
    return $a['weight'] < $b['weight'] ? -1 : 1;
  });
  return $definitions;
}