You are here

public function Layout::getDerivativeDefinitions in Layout 8

Implements DerivativeInterface::getDerivativeDefinitions().

1 call to Layout::getDerivativeDefinitions()
Layout::getDerivativeDefinition in lib/Drupal/rlayout/Plugin/Derivative/Layout.php
Implements DerivativeInterface::getDerivativeDefinition().

File

lib/Drupal/rlayout/Plugin/Derivative/Layout.php, line 42
Definition of Drupal\rlayout\Plugin\Derivative\Layout.

Class

Layout
Layout plugin derivative definition.

Namespace

Drupal\rlayout\Plugin\Derivative

Code

public function getDerivativeDefinitions(array $base_plugin_definition) {

  // Use module_invoke() because plugins are active even if the module is not
  // enabled.
  $this->derivatives = array();
  $layouts = module_invoke('rlayout', 'load_all');
  if (!empty($layouts)) {
    foreach ($layouts as $key => $layout) {
      $this->derivatives[$key] = array(
        'id' => $layout
          ->id(),
        'title' => $layout
          ->label(),
        'available regions' => $layout->regions,
        'region overrides' => $layout->overrides,
        'class' => 'Drupal\\rlayout\\Plugin\\layout\\layout\\ResponsiveLayout',
      );
    }
  }
  return $this->derivatives;
}