How to check if view result is empty Twig

How to check if view result is empty Twig

To check the field I use the following code: {% if content.field_name|render is empty %} How to check on node.twig if {{ my_cool_view }} result is empty? Is this generally possible in Drupal 8? Thank you for help. read more
How to check if view result is empty Twig

Altering Views Exposed Form Elements and their Associated Labels

I have a series of Views Exposed Forms across a Drupal 8 website. My goal is to generate unique template suggestions so I can theme each individual input and their labels differently as needed. Here is my current approach. Placed into theme.theme. I’ve hit a... read more
How to check if view result is empty Twig

How to use language-specific menu items in URL aliases

I’m working on a site with internationalization from the source language, English, into a few other languages. Translating the pages has worked out fine; however, I’m running into trouble with URL aliases. Some of our pages have different menu labels vs.... read more
How to check if view result is empty Twig

Where can I find the form API reference?

Form API Reference gives information about which properties to use for a form array, for Drupal 7. Where can I see what properties I can use in buildForm(array $form, FormStateInterface $form_state), such as #type, #title, #required, and other possible properties?... read more
How to check if view result is empty Twig

How to Unit Test Entity Reference Field Value

I have been tasked with writing a Unit Test for a method where I pass in a Node object, modify an Entity Reference field value, and then return a Node object. Since this is a Unit test, I am unsure as to how to write an assertion. Note: just included relevant code.... read more
How to check if view result is empty Twig

How capture video thumbnail , when video is uploaded under media video type file?

I’m using Core media module to upload video[Media Type is video,which has field video of ‘file field type’]. This module will refer video.png as thumnail for all video uploaded from the local system. I want to capture first frame of video as... read more
How to check if view result is empty Twig

AJAX doesn’t work in custom form element

I want to create a custom form element for email that have a textfield and button and when click button send an email but ajax not working inside form elemen class. I test it in form api and it’s ok but when move in form element on button click nothing happend... read more
How to check if view result is empty Twig

Call to a member function label() on null after saving a node with a taxonomy term

I create nodes, which have a taxonomy field, like this: $node = Node::create([ ‘type’ => ‘article’, ‘status’ => 1, ‘title’ => ‘Some title’, … ‘field_taxonomy’ => [1, 2, 3], ]);... read more
How to check if view result is empty Twig

How to reference URL relative to current page in a block

I have a custom block where I need to reference a URL relative to the current page (such as node/7/images or node/293/images) that will link to the “Images” view mode I made for the node. I am using a module so that a view mode is accessible via URL (which... read more