annotate core/modules/tour/tour.api.php @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 4c8ae668cc8c
children
rev   line source
Chris@0 1 <?php
Chris@0 2
Chris@0 3 /**
Chris@0 4 * @file
Chris@0 5 * Describes API functions for tour module.
Chris@0 6 */
Chris@0 7
Chris@0 8 /**
Chris@0 9 * @addtogroup hooks
Chris@0 10 * @{
Chris@0 11 */
Chris@0 12
Chris@0 13 /**
Chris@0 14 * Allow modules to alter tour items before render.
Chris@0 15 *
Chris@0 16 * @param array $tour_tips
Chris@0 17 * Array of \Drupal\tour\TipPluginInterface items.
Chris@0 18 * @param \Drupal\Core\Entity\EntityInterface $entity
Chris@0 19 * The tour which contains the $tour_tips.
Chris@0 20 */
Chris@0 21 function hook_tour_tips_alter(array &$tour_tips, Drupal\Core\Entity\EntityInterface $entity) {
Chris@0 22 foreach ($tour_tips as $tour_tip) {
Chris@0 23 if ($tour_tip->get('id') == 'tour-code-test-1') {
Chris@0 24 $tour_tip->set('body', 'Altered by hook_tour_tips_alter');
Chris@0 25 }
Chris@0 26 }
Chris@0 27 }
Chris@0 28
Chris@0 29 /**
Chris@0 30 * Allow modules to alter tip plugin definitions.
Chris@0 31 *
Chris@0 32 * @param array $info
Chris@0 33 * The array of tip plugin definitions, keyed by plugin ID.
Chris@0 34 *
Chris@0 35 * @see \Drupal\tour\Annotation\Tip
Chris@0 36 */
Chris@0 37 function hook_tour_tips_info_alter(&$info) {
Chris@0 38 // Swap out the class used for this tip plugin.
Chris@0 39 if (isset($info['text'])) {
Chris@0 40 $info['class'] = 'Drupal\mymodule\Plugin\tour\tip\MyCustomTipPlugin';
Chris@0 41 }
Chris@0 42 }
Chris@0 43
Chris@0 44 /**
Chris@0 45 * @} End of "addtogroup hooks".
Chris@0 46 */