This forum is for assistance with theme development.

Adding External CSS & JS

Hello and good day to you all. I am a drupal novice and am NOT a developer by any stretch of the imagination. I work for a company that had a developer managing our website but since left. So far I have learned how to use Drupal as I have gone along including modifying our hosted files for CSS purposes and changing website layout etc. I have no working knowledge of PHP or JS so bear with me.

Display a field only if option (x) isn't selected

In one of my content types, I have a Status field (field_status) which is a List(text) field displaying 3 radio button options set to the following key|label values:

  • 0|In Stock
  • 1|Under Deposit
  • 2|Sold

I have a custom twig template file for this content type and was wondering how I would display the label value ONLY if the option isn't 0|In Stock. In Stock is pretty much the default option so when the item is sold/under deposit, I want a "Sold/Under Deposit" banner to appear in the upper corner of the picture of the item.

Print admin tabs in D8

Hi,

I've created a page template to display content but the admin tabs (to edit, manage display or delete) is not displayed.

How can I print it in twig ?

Can't upload logo gif

I've still got a lot to learn about D8 in general while I'm getting close to building a development environment on Windows 10 with IIS 10, MySQL, and PHP 7.1.3. Many thanks to drupalonwindows.com and a few others for hints. (Various WAMP stacks would be great if Apache worked on Windows.)

I've created a new site with composer create-project drupal-composer/drupal-project:8.x-dev and then required a contrib theme, which looks pretty good.

Custom Theme Suggestion not recognised

Hi there,

I'm trying to set up a custom theme suggestion for Drupal 8 so i can target a specific input field based on the ID of the field.

This is the code i have written:

/**
 * @param $suggestions
 * @param array $variables
 */
function MYTHEME_theme_suggestions_input_alter(&$suggestions, array $variables) {
  $element = $variables['element'];
  $suggestions[] = 'input__' . $element['#id'];
}

This is the template i have added to my theme:

Magic variables in twig files

Hi All,

I'm looking at a page.html.twig in the danland Drupal 8 theme and see something like this:

          <div class="slideshow">
            {% for file in files %}
              <img src="{{ file.uri }}" width="100%" height="100%" alt="{{ file.name }}"/>
            {% endfor %}
          </div>

I can't seem to determine where this "files" variable is defined.

Pages

Subscribe with RSS Subscribe to RSS - Theme development