Correct way to add '#element_validate' callback to a form element

When I look through core code adding #element_validate callbacks to form elements, I see several different ways it is done:

Token Twig Filter

Hello,

Before I go and create my own, does a Twig Filter already exist to parse Tokens ? 

I know there is the Token Filter module that exists but it does not work for plain text format which forces me to do the filtering at the template level.

Thanks in advance !

REST API create user with role, language

I'm generating users via REST API and I want to assign both the user role and preferred language upon creation.

I'm unable to find any information on the body content format.

const body = {

'name': [{'value': name}],

'mail': [{'value': email}],

'pass': [{'value': password}],

'roles': [{'target_id': 'user'}],

'preferred_language': [{'value': 'en'}]

};

What is the proper format for 'Roles' and 'Preferred Language'. 

Users generate fine if I don't try creating the role or language.

Image File type has disappeared

I am using Progressive — Multipurpose Responsive Drupal 7 & 8 Theme by NikaDev

Originally, I was trying to add the alt text using the files section under content, however it does not appear to be there, and I do need to add this. However, I have noticed that there is no way to select the file type when uploading an image (works fine with documents).

Custom HTML template for search's row results

Hello I come to you because, on Drupal 8, I can not find my solution.

In fact, I have a search form on my site.

This form allows you to search on different types of content.

The search is done with Search_API and I use Views to create the search form. Then, I use the grouping of fields in drupal to group search results by Content Type.

I have two types of content:
- general articles
- some products 

In fact what I would like is that each line of search result is on a particular template based on the type of content.

Views - Date filter granularity

I'm trying to add a date filter in the Content view (administration), so the users can filter the nodes by a specific date (like 17/04/2019). The problem is the granularity is set to seconds by default, so I must specify also the hour, minutes and seconds, otherwise, it doesn't work.

I remember in Drupal 7 we had the option to change the granularity of a date filter inside a view, but there's no granularity option in Drupal 8.

What can I do to solve this?

Pages

Subscribe with RSS Subscribe to RSS - Drupal 8.x