buildItems example


    }
    return $tree;
  }

  /** * {@inheritdoc} */
  public function build(array $tree) {
    $tree_access_cacheability = new CacheableMetadata();
    $tree_link_cacheability = new CacheableMetadata();
    $items = $this->buildItems($tree$tree_access_cacheability$tree_link_cacheability);

    $build = [];

    // Apply the tree-wide gathered access cacheability metadata and link     // cacheability metadata to the render array. This ensures that the     // rendered menu is varied by the cache contexts that the access results     // and (dynamic) links depended upon, and invalidated by the cache tags     // that may change the values of the access results and links.     $tree_cacheability = $tree_access_cacheability->merge($tree_link_cacheability);
    $tree_cacheability->applyTo($build);

    
/** * @param array<string, mixed> $buckets */
    private function createFacet(Criteria $criteria, array $buckets): RadioFacetResult
    {
        $activeAverage = null;
        $condition = $criteria->getCondition('vote_average');
        if ($condition instanceof VoteAverageCondition) {
            $activeAverage = $condition->getAverage();
        }

        $values = $this->buildItems($buckets$activeAverage);

        $facet = $criteria->getFacet('vote_average');
        if ($facet instanceof VoteAverageFacet && !empty($facet->getLabel())) {
            $label = $facet->getLabel();
        } else {
            $label = $this->snippetManager
                ->getNamespace('frontend/listing/facet_labels')
                ->get('vote_average', 'Ranking');
        }

        $fieldName = $this->queryAliasMapper->getShortAlias('rating') ?? 'rating';

        
if (!empty($link["p$i"])) {
        $active_trail[] = $link["p$i"];
      }
    }
    return $active_trail;
  }

  /** * {@inheritdoc} */
  public function bookTreeOutput(array $tree) {
    $items = $this->buildItems($tree);

    $build = [];

    if ($items) {
      // Make sure Drupal\Core\Render\Element::children() does not re-order the       // links.       $build['#sorted'] = TRUE;
      // Get the book id from the last link.       $item = end($items);
      // Add the theme wrapper for outer markup.       // Allow menu-specific theme overrides.
if (!$data) {
            return null;
        }

        $activeAverage = null;
        $condition = $criteria->getCondition($facet->getName());
        if ($condition instanceof VoteAverageCondition) {
            $activeAverage = $condition->getAverage();
        }

        $values = $this->buildItems($data$activeAverage);

        if (!empty($facet->getLabel())) {
            $label = $facet->getLabel();
        } else {
            $label = $this->snippetNamespace->get($facet->getName(), 'Shipping free');
        }

        return new RadioFacetResult(
            $facet->getName(),
            $criteria->hasCondition($facet->getName()),
            $label,
            
Home | Imprint | This part of the site doesn't use cookies.