This forum is for assistance with theme development.

Rendering field values for a custom content type

I've created a simple custom content type with four fields:

  • field_slogan
  • field_poster
  • field_contact
  • body

The field_poster is an image field type. 

I can get the to the other 3 fields to render using:

  • {{ node.field_slogan.0.value|raw }}
  • {{ node.field_contact.0.value|raw }}
  • {{ node.body.value|raw }}

But I can't get the image field - field_poster - to render no matter I try. The following have all failed:

Drupal 9 Multiple controllers with multiple modules and templates

I want to create 2 controllers with 2 templates。 How can I build it wisely? 

I have my first module in drupal 9 with three files in modules section of my drupal:

example1.routing.yml:( in modules/example1/)

exmaple1:
    path: '/example1'
    defaults:
        _controller: '\Drupal\example1\Controller\Example1Controller::view'
    requirements:
        _permission: 'access content'

example1.info.yml: ( in modules/example1/)

name: example1 Template

Anyone Try D10's StarterKit?

I'm testing Drupal 10's StarterKit Theme script. I issue the script command, giving a theme name, but the theme is never created? What gives? Should I stick with the traditional subtheme practice?

How to merge a second level array into primary array in TWIG

Is it possible to merge a secondary level array into a primary array without creating new primary arrays.  For example I have a set of “tiles” that need to have an array of “list” that I’m merging like so.

{% set tiles = [] %} {% set list = [] %}

{% for item in content.field_tiles %}

{% if item['#paragraph'].field_image.value %}

{% set tiles = tiles | merge([{

Sub Theme

Pages

Subscribe with RSS Subscribe to RSS - Theme development