function hook_tour_tips_alter

Same name in other branches
  1. 8.9.x core/modules/tour/tour.api.php \hook_tour_tips_alter()
  2. 10 core/modules/tour/tour.api.php \hook_tour_tips_alter()
  3. 11.x core/modules/tour/tour.api.php \hook_tour_tips_alter()

Allow modules to alter tour items before render.

Parameters

array $tour_tips: Array of \Drupal\tour\TipPluginInterface items.

\Drupal\Core\Entity\EntityInterface $entity: The tour which contains the $tour_tips.

Related topics

2 functions implement hook_tour_tips_alter()

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

language_tour_tips_alter in core/modules/language/language.module
Implements hook_tour_tips_alter().
tour_test_tour_tips_alter in core/modules/tour/tests/tour_test/tour_test.module
Implements hook_tour_tips_alter().
1 invocation of hook_tour_tips_alter()
Tour::getTips in core/modules/tour/src/Entity/Tour.php
Returns the tips for this tour.

File

core/modules/tour/tour.api.php, line 21

Code

function hook_tour_tips_alter(array &$tour_tips, \Drupal\Core\Entity\EntityInterface $entity) {
    foreach ($tour_tips as $tour_tip) {
        if ($tour_tip->get('id') == 'tour-code-test-1') {
            $tour_tip->set('body', 'Altered by hook_tour_tips_alter');
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.