You are here

public function DiffBuilderManager::getPluginDefinitions in Diff 8

Initializes the local pluginDefinitions property.

Loop over the plugin definitions and build an array keyed by the field type that plugins can be applied to.

Return value

array The initialized plugins array sort by field type.

1 call to DiffBuilderManager::getPluginDefinitions()
DiffBuilderManager::getApplicablePluginOptions in src/DiffBuilderManager.php
Gets the applicable plugin options for a given field.

File

src/DiffBuilderManager.php, line 241

Class

DiffBuilderManager
Plugin type manager for field diff builders.

Namespace

Drupal\diff

Code

public function getPluginDefinitions() {
  if (!isset($this->pluginDefinitions)) {

    // Get the definition of all the FieldDiffBuilder plugins.
    foreach ($this
      ->getDefinitions() as $plugin_definition) {
      if (isset($plugin_definition['field_types'])) {

        // Iterate through all the field types this plugin supports
        // and for every such field type add the id of the plugin.
        if (!isset($plugin_definition['weight'])) {
          $plugin_definition['weight'] = 0;
        }
        foreach ($plugin_definition['field_types'] as $id) {
          $this->pluginDefinitions[$id][$plugin_definition['id']]['weight'] = $plugin_definition['weight'];
        }
      }
    }
  }
  return $this->pluginDefinitions;
}