This forum is for assistance with theme development.

Create a page with its own specific content fields, template, and path?

Hi! I'm new to Drupal—and struggling to figure this out.

I'm trying to create a page that has specific content requirements. I'd like it to:

  • Have a unique set of custom content fields
  • Use a specific template
  • Show up at a specific path

Is this possible?

When I try to use the Page Manager to create a page, I'm confused by what the "Variant Types" are about. I don't want to use Blocks or Panels (I don't think anyway)—I'm just wanting to be able to create specific, custom fields for the page and then reference them in a template.

Using a variable inside a field name in Twig

I have 16 fields that are numbered (e.g. node.field_1.value, node.field_2.value, etc.). Rather than call each of these separately, I'd like to use a loop in my Twig template. So, I've got:

{% for i in 1..16 %}
{{ attribute(_context,"node.field_"~i~".value") }}
{% endfor }}

Using the attribute function from Twig.

But this doesn't work. It seems like it should, but I'm not doing something correct.

LInk Image field to URL sourced from another Field in Views

I'm not entirely sure of the correct way to describe this,

but I have a View page setup for events.

One field is "Ticket Link" and Another is "Event Image"

The listing page is being displayed via a Structure / View setup.

I want the Image when clicked, to link to the URL that is sourced from the "Ticket Link" field (external links)

How would I do that?

preprocess function crashes when trying to view revisions

I have the following preprocess_node function..

Date Time displays different times

In my twig template for Events I currently have date listed 3 ways:

template_from_string doesn't work

Hi,

I'm trying to allow the user to create a template in a field (type-long, formatted) on a node page, including {{ twig }} within the the string that will be in the field.

If I understand the Twig documentation, I should then be able to call {{ include(template_from_string(node.field.value)) }} to use the content of the field. I would then be able to pass in custom variables, etc. within the theme template.html.twig.

Pages

Subscribe with RSS Subscribe to RSS - Theme development