You are here

function hook_sandwich_info_alter in Examples for Developers 3.x

Same name and namespace in other branches
  1. 8 plugin_type_example/plugin_type_example.api.php \hook_sandwich_info_alter()

Alter the definitions of all the Sandwich plugins.

You can implement this hook to do things like change the properties for each plugin or change the implementing class for a plugin.

This hook is invoked by SandwichPluginManager::__construct().

Parameters

array $sandwich_plugin_info: This is the array of plugin definitions.

1 function implements hook_sandwich_info_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

plugin_type_example_sandwich_info_alter in modules/plugin_type_example/plugin_type_example.module
Implements hook_sandwich_info_alter().
1 invocation of hook_sandwich_info_alter()
SandwichPluginManager::__construct in modules/plugin_type_example/src/SandwichPluginManager.php
Creates the discovery object.

File

modules/plugin_type_example/plugin_type_example.api.php, line 19
Hooks specific to the plugin_type_example module.

Code

function hook_sandwich_info_alter(array &$sandwich_plugin_info) {

  // Let's change the 'foobar' property for all sandwiches.
  foreach ($sandwich_plugin_info as $plugin_id => $plugin_definition) {
    $sandwich_plugin_info[$plugin_id]['foobar'] = t('We have altered this in the alter hook');
  }
}