getTips example

$this->assertEquals('simpletest@example.com', $config->get('mail'));

    // Ensure that the configuration entity has the expected dependencies and     // overrides.     $action = Action::load('user_block_user_action');
    $this->assertEquals('Overridden block the selected user(s)', $action->label());
    $action = Action::load('user_cancel_user_action');
    $this->assertEquals('Cancel the selected user account(s)', $action->label(), 'Default configuration that is not overridden is not affected.');

    // Ensure that optional configuration can be overridden.     $tour = Tour::load('language');
    $this->assertCount(1, $tour->getTips(), 'Optional configuration can be overridden. The language tour only has one tip');
    $tour = Tour::load('language-add');
    $this->assertCount(3, $tour->getTips(), 'Optional configuration that is not overridden is not affected.');

    // Ensure the optional configuration is installed. Note that the overridden     // language tour has a dependency on this tour so it has to exist.     $this->assertInstanceOf(Tour::class, Tour::load('testing_config_overrides_module'));

    // Ensure that optional configuration from a profile is created if     // dependencies are met.     $this->assertEquals('Config override test', Tour::load('testing_config_overrides')->label());

    
class TourViewBuilder extends EntityViewBuilder {

  /** * {@inheritdoc} */
  public function viewMultiple(array $entities = []$view_mode = 'full', $langcode = NULL) {
    /** @var \Drupal\tour\TourInterface[] $entities */
    $tour = [];
    $cache_tags = [];
    $total_tips = 0;
    foreach ($entities as $entity_id => $entity) {
      $tour[$entity_id] = $entity->getTips();
      $total_tips += count($tour[$entity_id]);
      $cache_tags = Cache::mergeTags($cache_tags$entity->getCacheTags());
    }

    $items = [];
    foreach ($tour as $tour_id => $tips) {
      $tourEntity = $entities[$tour_id];

      foreach ($tips as $index => $tip) {
        $classes = [
          'tip-module-' . Html::getClass($tourEntity->getModule()),
          
Home | Imprint | This part of the site doesn't use cookies.