SelectionBase.php in Multi-path autocomplete 8
File
lib/Drupal/mpac/Plugin/Derivative/SelectionBase.php
View source
<?php
namespace Drupal\mpac\Plugin\Derivative;
use Drupal\Component\Plugin\Derivative\DerivativeInterface;
class SelectionBase implements DerivativeInterface {
protected $derivatives = array();
public function getDerivativeDefinition($derivative_id, array $base_plugin_definition) {
if (!empty($this->derivatives) && !empty($this->derivatives[$derivative_id])) {
return $this->derivatives[$derivative_id];
}
$this
->getDerivativeDefinitions($base_plugin_definition);
return $this->derivatives[$derivative_id];
}
public function getDerivativeDefinitions(array $base_plugin_definition) {
$supported_types = array(
'path',
'shortcut',
);
foreach (mpac_selection_plugin_info() as $type => $info) {
if (!in_array($type, $supported_types)) {
$this->derivatives[$type] = $base_plugin_definition;
$this->derivatives[$type]['label'] = t('@type selection', array(
'@type' => $info['label'],
));
}
}
return $this->derivatives;
}
}
Classes
Name |
Description |
SelectionBase |
Base class for selection plugins provided by Multi-path autocomplete. |