replaceFieldPlaceholder example


  public static function replaceFieldPlaceholder(array &$build, array $built_field$field_name) {
    foreach (Element::children($build) as $child) {
      if (isset($build[$child]['#extra_field_placeholder_field_name']) && $build[$child]['#extra_field_placeholder_field_name'] === $field_name) {
        $placeholder_cache = CacheableMetadata::createFromRenderArray($build[$child]);
        $built_cache = CacheableMetadata::createFromRenderArray($built_field);
        $merged_cache = $placeholder_cache->merge($built_cache);
        $build[$child] = $built_field;
        $merged_cache->applyTo($build);
      }
      else {
        static::replaceFieldPlaceholder($build[$child]$built_field$field_name);
      }
    }
  }

  /** * {@inheritdoc} */
  protected function blockAccess(AccountInterface $account) {
    return $this->getEntity()->access('view', $account, TRUE);
  }

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