New answers tagged

0 votes

How to change the title and add a placeholder to password and confirm password field through hook_form_alter?

Code to Alter pass & confirm pass field title along with password strength indicator display: Drupal(8/9/10) use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Render\Element\PasswordConfirm;...
mini's user avatar
  • 682
0 votes

How can I hide a specific region according to its url?

You can use hook_preprocess_page() hook (.modue/.theme file) to hide footer region conditionally: function Mymodulename_preprocess_page(&$vars) { $vars['display_footer_region'] = true; $...
mini's user avatar
  • 682
0 votes

How to access and change a form's display mode in hook_form_alter() or similar?

There ought to be a method to get this analogous to $form_state->getFormObject()->getOperation() but I am not aware of one. You can fallback to getting the form display mode from the query ...
Liam Morland's user avatar
2 votes

How do I replace hook_field_widget_WIDGET_TYPE_form_alter() with hook_field_widget_complete_WIDGET_TYPE_form_alter()?

hook_field_widget_WIDGET_TYPE_form_alter() is replaced by hook_field_widget_single_element_WIDGET_TYPE_form_alter(). See the change record Streamline Field Widget Hooks. It's not replaced by ...
4uk4's user avatar
  • 98.1k
0 votes

How do I replace hook_field_widget_WIDGET_TYPE_form_alter() with hook_field_widget_complete_WIDGET_TYPE_form_alter()?

It took hours to figure out because the extent to which your code needs to change is not documented anywhere I could find. I had to painstakingly parse through the data and cobble together the ...
SomebodySysop's user avatar

Top 50 recent answers are included