Zum Inhalt springen

Felder im Theme auslesen

Aus Computech CMS Wiki

Allg.

Twig

  • gerendert content.field_anleser

Preprocess Function

  • $variables['var_field_titel'] = $paragraph->get('field_titel')->value;
  • $variables['var_field_titel'] = $paragraph->field_titel->value;


Twig

  • gerendert content.field_link
  • einzelene Werte content.field_link[0]['#url']


Preprocess Function

  • $variables['var_field_link'] = $paragraph->get('field_link')->first()->getUrl();
  • $variables['var_field_link'] = $paragraph->field_link->uri;


Paragraphs

function meostheme_preprocess_paragraph(&$variables) {
    $paragraph = $variables['elements']['#paragraph'];
    if ($paragraph->bundle() == "p_box") {
        $variables['var_field_titel'] = $paragraph->field_titel->value;    
    }
}