You are here

public function TypeManager::processDefinition in Charts 5.0.x

Same name and namespace in other branches
  1. 8.4 src/TypeManager.php \Drupal\charts\TypeManager::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/TypeManager.php, line 79

Class

TypeManager
Manages discovery and instantiation of charts_type_info plugins.

Namespace

Drupal\charts

Code

public function processDefinition(&$definition, $plugin_id) {
  parent::processDefinition($definition, $plugin_id);
  $definition['id'] = $plugin_id;
  foreach ([
    'label',
  ] as $required_property) {
    if (empty($definition[$required_property])) {
      throw new PluginException(sprintf('The charts type %s must define the %s property.', $plugin_id, $required_property));
    }
  }
}