You are here

public function DiffLayoutManager::getPluginOptions in Diff 8

Gets the applicable layout plugins.

Loop over the plugins that can be used to display the diff comparison sorting them by the weight.

Return value

array The layout plugin options.

1 call to DiffLayoutManager::getPluginOptions()
DiffLayoutManager::getDefaultLayout in src/DiffLayoutManager.php
Gets the default layout plugin selected.

File

src/DiffLayoutManager.php, line 73

Class

DiffLayoutManager
Plugin type manager for field diff builders.

Namespace

Drupal\diff

Code

public function getPluginOptions() {
  $plugins = $this->config
    ->get('general_settings.layout_plugins');
  $plugin_options = [];

  // Get the plugins sorted and build an array keyed by the plugin id.
  if ($plugins) {

    // Sort the plugins based on their weight.
    uasort($plugins, 'Drupal\\Component\\Utility\\SortArray::sortByWeightElement');
    foreach ($plugins as $key => $value) {
      if ($this
        ->hasDefinition($key)) {
        $plugin = $this
          ->getDefinition($key);
        if ($plugin && $value['enabled']) {
          $plugin_options[$key] = $plugin['label'];
        }
      }
    }
  }
  return $plugin_options;
}