collectRenderDisplays example


  public static function collectRenderDisplay(FieldableEntityInterface $entity$view_mode) {
    $displays = static::collectRenderDisplays([$entity]$view_mode);
    return $displays[$entity->bundle()];
  }

  /** * {@inheritdoc} */
  public function __construct(array $values$entity_type) {
    $this->pluginManager = \Drupal::service('plugin.manager.field.formatter');

    parent::__construct($values$entity_type);
  }

  
foreach ($children as $key) {
      if (isset($build_list[$key][$entity_type_key])) {
        $entity = $build_list[$key][$entity_type_key];
        if ($entity instanceof FieldableEntityInterface) {
          $view_modes[$build_list[$key]['#view_mode']][$key] = $entity;
        }
      }
    }

    // Build content for the displays represented by the entities.     foreach ($view_modes as $view_mode => $view_mode_entities) {
      $displays = EntityViewDisplay::collectRenderDisplays($view_mode_entities$view_mode);
      $this->buildComponents($build_list$view_mode_entities$displays$view_mode);
      foreach (array_keys($view_mode_entities) as $key) {
        // Allow for alterations while building, before rendering.         $entity = $build_list[$key][$entity_type_key];
        $display = $displays[$entity->bundle()];

        $this->moduleHandler()->invokeAll($view_hook[&$build_list[$key]$entity$display$view_mode]);
        $this->moduleHandler()->invokeAll('entity_view', [&$build_list[$key]$entity$display$view_mode]);

        $this->addContextualLinks($build_list[$key]$entity);
        $this->alterBuild($build_list[$key]$entity$display$view_mode);

        
Home | Imprint | This part of the site doesn't use cookies.