New answers tagged hooks
0
votes
Why does this code to create a dependent dropdown not work?
Without some kind of content, a prefix and suffix are not rendered. That means this element will not render anything on the page:
// Wrapper for city dropdown list
$form['sandbox_ajax_dropdown']['...
- 16.1k
0
votes
How can I bulk update node content after adding a hook_form_alter to set default values?
I made a small script to be executed by drush, that basically uses the same processing that I developed to set the default values, but in the script I use the entityTypeManager to get the nodes and ...
- 349
0
votes
Feeds: Hook after Import done
If you're looking at this post and wondering why your hook is not working is because in the D8 version of Feeds, all hooks are gone and most of them are converted to events.
The equivalent for this ...
0
votes
What techniques exist to obfuscate emails everywhere on the page?
On response level you can use an event subscriber, as suggested by @cilefen. You find a good example for anonymous traffic in core:
/core/lib/Drupal/Core/EventSubscriber/ActiveLinkResponseFilter.php
...
- 92.7k
1
vote
using hook_form_alter() to change year range of datetime select widget, with deltas for multi-value fields
I think you probably want this:
$fields = [
'field_draft_evaluation_date',
'field_draft_protocol_date',
'field_updated_milestone_plandate',
'field_committee_date',
'...
- 16.1k
1
vote
Accepted
How can I add a button to every row of custom column?
In /admin/structure/views/view/YOUR_VIEW_ID, add a new field (Custom text)
In your hook, use the following code
function sortd_preprocess_views_view_field(&$vars){
if ($vars['view']->id() == ...
- 44
1
vote
Accepted
How can I dynamically change the default value for views exposed filter based on the terms weight?
After extensive search and experiment, this code worked for me:
use Drupal\taxonomy\Entity\Term;
use Drupal\views\ViewExecutable;
/**
* Implements hook_views_pre_build().
*/
function ...
Top 50 recent answers are included
Related Tags
hooks × 26397 × 878
8 × 538
theming × 404
nodes × 284
forms × 282
views × 255
entities × 219
users × 185
routes × 114
6 × 86
blocks × 83
webforms × 67
commerce × 60
database × 52
javascript × 51
navigation × 46
taxonomy-terms × 44
ajax × 42
files × 41
media × 37
9 × 37
emails × 34
search × 33
caching × 27