modules

Articles about modules from the drupal community

Drupal 8 and hook form alter: How to check if taxonomy term is new or old?

Oct
2020
08
If you want to check with hook_form_alter if the taxonomy term is new or updated (old) you can't use the form_id or the $form_state->getFormObject()->getOperation() because it always returns "default". The solution for this is : $form_state->getFormObject()->getEntity()->isNew() So for example:

Altering image field widget “alt” or title" label

Jan
2017
04
For altering the "Title" and "Alternate Text" textfields of an image field we have to add an extra Proccess function for the widget form.
// Alter image Title for field_top_image instance
function MYMODULE_field_widget_form_alter(&$element, &$form_state, $context) {

Hook node_view and content

Jul
2015
08
I was trying to remove some field collection items (with default values but only for one subfield) from a node and although everything was working fine nothing was changing. So what was i doing wrong then? Well there a "small" catch that it is not clear about the node object that is rendered inside the node_view hook.

How to add a custom class to a view row ?

Apr
2014
07
Problem: I have a node default field called 'published' which is an list integer checkbox. When using Views to display a list of this content, I would like to add a css class to the item wrapper when that value is 1 like so:

Views and Taxonomy Terms Translation

Feb
2013
12
Have you ever searched “Views” for a way to filter the taxonomy terms by language (as done for nodes), but you didn't find a way to do it? Does “Views” also support that filter in taxonomies or only in nodes? How can I filter the taxonomy terms by language?

How to make a range selector filter in Views

Sep
2012
04
So you think you've figured out everything with drupal and views until you get the request from a client that just cannot be done via stock Views;What was the request about? Making a select box with a range of values where all you have is a CCK number/float.Wait,what?impossible you say?No,not of course , not at all !

Exclude current authenticated user from a user list view ?

Apr
2012
22

Lets say you want to build a view that displays all the common fields that the current authenticated user has with the rest of the website users . For example lets say that Mike wants to see all the other 'male' users of the website . When Mike filters the user-list view he gets his name to by default.

Pages

Subscribe to RSS - modules
this is an arrow pointing back to the top of the page