&$alterable, * 'unalterable' => $unalterable, * 'foo' => 'bar', * ); * $this->alter('mymodule_data', $alterable1, $alterable2, $context); * @endcode * * Note that objects are always passed by reference in PHP5. If it is * absolutely required that no implementation alters a passed object in * $context, then an object needs to be cloned: * @code * $context = array( * 'unalterable_object' => clone $object, * ); * $this->alter('mymodule_data', $data, $context); * @endcode * * @param string|array $type * A string describing the type of the alterable $data. 'form', 'links', * 'node_content', and so on are several examples. Alternatively can be an * array, in which case $theme_TYPE_alter() is invoked for each value in the * array. When Form API is using $this->alter() to * execute both $theme_form_alter() and $theme_form_FORM_ID_alter() * implementations, it passes array('form', 'form_' . $form_id) for $type. * @param mixed $data * The variable that will be passed to $theme_TYPE_alter() implementations * to be altered. The type of this variable depends on the value of the * $type argument. For example, when altering a 'form', $data will be a * structured array. When altering a 'profile', $data will be an object. * @param mixed $context1 * (optional) An additional variable that is passed by reference. * @param mixed $context2 * (optional) An additional variable that is passed by reference. If more * context needs to be provided to implementations, then this should be an * associative array as described above. * * @see \Drupal\Core\Extension\ModuleHandlerInterface */ public function alter($type, &$data, &$context1 = NULL, &$context2 = NULL); /** * Provides an alter hook for a specific theme. * * Similar to ::alter, it also invokes the alter hooks for the base themes. * * @param \Drupal\Core\Theme\ActiveTheme $theme * A manually specified theme. * @param string|array $type * A string describing the type of the alterable $data. * @param mixed $data * The variable that will be passed to $theme_TYPE_alter() implementations * @param mixed $context1 * (optional) An additional variable that is passed by reference. * @param mixed $context2 * (optional) An additional variable that is passed by reference. * * @see ::alter */ public function alterForTheme(ActiveTheme $theme, $type, &$data, &$context1 = NULL, &$context2 = NULL); }