You are here

public function TwigExtensionsPluginManager::processDefinition in Twig Extender 8

Same name and namespace in other branches
  1. 8.4 src/Plugin/Twig/TwigExtensionsPluginManager.php \Drupal\twig_extender\Plugin\Twig\TwigExtensionsPluginManager::processDefinition()
  2. 8.2 src/Plugin/Twig/TwigExtensionsPluginManager.php \Drupal\twig_extender\Plugin\Twig\TwigExtensionsPluginManager::processDefinition()
  3. 8.3 src/Plugin/Twig/TwigExtensionsPluginManager.php \Drupal\twig_extender\Plugin\Twig\TwigExtensionsPluginManager::processDefinition()
  4. 4.x src/Plugin/Twig/TwigExtensionsPluginManager.php \Drupal\twig_extender\Plugin\Twig\TwigExtensionsPluginManager::processDefinition()

Performs extra processing on plugin definitions.

By default we add defaults for the type to the definition. If a type has additional processing logic they can do that by replacing or extending the method.

Overrides DefaultPluginManager::processDefinition

File

src/Plugin/Twig/TwigExtensionsPluginManager.php, line 61

Class

TwigExtensionsPluginManager
Plugin type manager for all twig plugins.

Namespace

Drupal\twig_extender\Plugin\Twig

Code

public function processDefinition(&$definition, $pluginId) {
  parent::processDefinition($definition, $pluginId);

  // Add the module or theme path to the 'path'.
  if ($this->moduleHandler
    ->moduleExists($definition['provider'])) {
    $definition['provider_type'] = 'module';
    return;
  }
  elseif ($this->themeHandler
    ->themeExists($definition['provider'])) {
    $definition['provider_type'] = 'theme';
    return;
  }
}