You are here

public function MiconDiscoveryManager::processDefinition in Micon 8

Same name and namespace in other branches
  1. 2.x src/MiconDiscoveryManager.php \Drupal\micon\MiconDiscoveryManager::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/MiconDiscoveryManager.php, line 107

Class

MiconDiscoveryManager
Provides the default micon.icon manager.

Namespace

Drupal\micon

Code

public function processDefinition(&$definition, $plugin_id) {
  parent::processDefinition($definition, $plugin_id);
  if (empty($definition['id'])) {
    throw new PluginException(sprintf('Plugin (%s) definition must include "id".', $plugin_id));
  }
  if (empty($definition['icon'])) {
    throw new PluginException(sprintf('Plugin (%s) definition must include "icon".', $plugin_id));
  }
  if (empty($definition['text']) && empty($definition['regex'])) {
    throw new PluginException(sprintf('Plugin (%s) definition must include "text" or "regex".', $plugin_id));
  }
}