How to check if a field value is empty

Hi,

I think this is one of most basic use cases but I really didnt find anything that solved my problem.

I just would like to know how to check with TWIG if a field value is not empty.

The following snippets didnt work:

{% if content.field_myfield %}
{% endif }

{% if content.field_myfield|length %}
{% endif }

{% if not empty content.field_myfield %}
{% endif }

I really dont know why this basic stuff is not documentated. Maybe I am wrong.

Thanks for your help.

Dynamic role assignment in code

Is it possible to a assign the logged in user to a role for a single page load? I'm using workflow In Drupal8 and I have to "put" a user in a role a single page request on node edit form.

Can't run Drush or Drupal Console on Drupal 8

I'm driving myself crazy with Composer on Drupal 8 as it has worked most of the time BUT drush and drupal console, in the vendor directory, do not function. I love Drush and initially downloaded and installed modules using Drush, as it is a great tool, which may have borked the installation ;/ .
Drupal was installed, on two accounts, using the project drupal-composer/drupal-project in December of 2015.

Drupal 8 custom css

None of the custom css modules have drupal 8 version released yet. Any idea how to add custom css in Drupal 8?

Beginning with Drupal

Hey all,

I am beginning the long journey to my first Drupal site. My company deals with lot's of granular data (weights, dimensions, materials, cycle times, feed rates, etc) - so, after research, Drupal seemed like a natural fit.

I have worked in Joomla since the mid 2006ish and Wordpress since 2010. I understand Drupal is a much more complex animal - but figured I would catch on to the learning curve at some point.

The problem, though, seems to be getting out of the starting gate.

I want the drupal page to be my home-page not /****** etc

Hello All,

This should be simple . When i type my home page url for my domain www.*****.CO.UK it does not show my drupal page because when i installed it, drupal, it defaults to www.*****.CO.UK/thedrupalpage_etc ?

How do i get the drupal page to display as the root of my domain please?

regards,

Tony

Pages

Subscribe with RSS Subscribe to RSS - Drupal 8.x