Helper Documentation
- Services API documentation
- Blocks
- Field widgets
- Form elements
- Form #states fixes
- Routing definition helpers
- Service definition helpers
- Twig helpers
- Theme helpers
Configurable helpers
Helpers are turned on or off in the enabled mapping of the helper.settings configuration. For example:
enabled:
core_form_novalidate: true
views_cache_tags_bundles: false
Or with Drush, using the YAML input format so that true and false are saved as booleans:
drush config:set --input-format=yaml helper.settings enabled.core_form_novalidate true
The default is the value set when the Helper module is installed. Some helpers use a different default when their setting is not saved at all, for example, because the helper was added after the module was installed. Or it might depend on another module being installed or not.
Core
The Helper module also renames core's text widgets to say whether each one is single-line or multi-line: Text field (single-line), Text area (multi-line), and Text area (WYSIWYG) for formatted text when the Editor module is enabled. This is not configurable.
cacheable_binary_file_response
Lets reverse proxies and CDNs, such as Varnish or a hosting provider's CDN, cache public files that Drupal sends itself, such as image style derivatives and file downloads from controllers. Core sends these with Cache-Control: private, or a bare public with no max-age. With this helper, they get the same Cache-Control header as pages, using the Browser and proxy cache maximum age from the performance settings, and the cache tags of the route's entities. Responses that set their own Cache-Control header are not changed. Drupal's own page caches still never store files. Like core, only files on the public scheme, or one listed in the file_additional_public_schemes setting, are made cacheable. Private and temporary files, including image style derivatives of private files, are never changed. See the core issue Make BinaryFileResponse cacheable.
- Type: Boolean
- Default: On when the Helper module is installed, but off on sites that installed it before this helper was added
core_entity_reference_hide_empty
Hides an entity reference field on entity forms if there are no referenceable entities that can be selected.
- Type: Boolean
- Default: Off
core_form_novalidate
Disables HTML5 validation for all forms. See the Drupal core issue on why HTML5 validation is bad.
- Type: Boolean
- Default: Off
- Alternatives: Disable HTML5 validation module
core_hide_layout_providers
Hides all layouts provided by the listed modules. This is often used to hide core's default layouts provided by the layout_discovery module:
enabled:
core_hide_layout_providers:
- layout_discovery
- Type: Array of module names
- Default: Empty
core_hide_text_format_help_single_format
Hides the text format help link on formatted text fields that allow only one text format. With one format, there is nothing for the editor to choose, so the help only adds noise. Drupal 11.4 removes the link from core, so this has no effect there.
- Type: Boolean
- Default: On, unless Drupal 11.4+ is used, or the Allowed Formats module is installed
- Requires: Text
- Alternatives: Allowed Formats module, which adds a setting to all formatted text widgets to hide the format guidelines and format help.
Warning
This helper is deprecated and will be removed once Drupal 11.4 is the minimum supported version.
core_states_conditions_fix
Fixes how #states compares values, so that conditions on multiple selects work, and adds regular expression, exclusive or and textarea lines conditions. The fixes are added to core's #states library, so they apply to every form. See Form #states fixes.
views_exposed_states_bundle_filter_fields needs it for a multiple select bundle filter.
- Type: Boolean
- Default: On when the Helper module is installed, but off on sites that installed it before this helper was added
core_text_long_textfield_widgets
Allows the Text field (single-line) widget to be used for Text (formatted, long) fields. Core only offers a text area for these fields, which usually means a full WYSIWYG editor, even for a one-line description. The value is still stored with a text format, and the field's allowed formats still apply.
A single-line input cannot contain line breaks, so browsers remove them when the form is submitted. If the field allows HTML, editors can type <br> or <p> tags instead.
- Type: Boolean
- Default: On
- Requires: Text
core_text_textarea_widgets
Allows textarea widgets to be used for plain text fields, so a field with a high character limit (for example, a description limited to 250 characters) no longer needs to be a Text (long) field.
Unlike the single-line widgets, the textarea widgets do not limit the length of the text in the browser. The field's maximum length is still checked when the form is submitted.
- Type: Boolean
- Default: Off
- Alternatives: Textarea widget for text fields module
redirect_entity_4xx_to_edit
Redirects a 403 or 404 response when viewing an entity to the entity's edit form, as long as the user has access to it. This is useful when a module like Rabbit Hole disables viewing certain entity types or bundles.
- Type: Boolean
- Default: Off
Layout Builder
layout_builder_entity_operation
Adds a Layout operation link to entities that can override their layout.
- Type: Boolean
- Default: On, unless the Layout Builder Operation Link module is installed
- Requires: Layout Builder
layout_builder_entity_operation_default_overridden
Makes the Layout operation link the default operation in entity listings when the entity's layout is overridden, or its default layout is empty. With the Navigation module, the Layout link also replaces the featured action in the top bar on those entities' pages.
- Type: Boolean
- Default: On
- Requires: Layout Builder
layout_builder_inline_block_validation
Prevents inline blocks from being added to default layouts.
- Type: Boolean
- Default: On
- Requires: Layout Builder
Media
media_oembed_iframe_title
Ensures that oEmbed media embedded with iframes has a title attribute for accessibility. See the core issue title attribute still not added to oEmbed iframe.
- Type: Boolean
- Default: On, unless the iFrame Title Filter module is installed
- Requires: Media
Menu
menu_links_prefer_deepest
When selecting a menu link, matches the deepest link found.
- Type: Boolean
- Default: Off
Navigation
navigation_create_links
Adds links for other entity types, such as media, to the Create menu of the Navigation module, which only lists content types. Keys are entity type IDs. An empty list adds every bundle, sorted by label, in a drop-down named after the entity type. A list of bundles adds only those, directly under Create. The setting replaces Navigation's own links for an entity type it lists, such as the Document and Image media type links in Drupal before 11.4.
enabled:
navigation_create_links:
# Every media type, in a "Media" drop-down.
media: []
enabled:
navigation_create_links:
# Only these media types, as links directly under Create.
media:
- document
- image
Only entity types with an add-form link template can be added. Redirect has none yet. Entity types and bundles that don't exist are skipped. The links are rebuilt when the setting changes, or when a bundle of a listed entity type is added or deleted. Users only see links to forms they can access.
- Type: Bundle lists keyed by entity type ID
- Default: Empty
Translation Management
tmgmt_hide_if_not_multilingual
Hides the Translation Management administration until the site has more than one language configured.
- Type: Boolean
- Default: On
- Requires: Translation Management Tool
Views
views_cache_tags_bundles
Replaces the generic entity list cache tag (such as node_list) with bundle list cache tags (such as node_list:article) in views that use the Tag based cache plugin and are filtered by bundle. Saving content of another bundle then no longer invalidates the view, or the pages that display it.
The bundles come from the view's bundle filter, including exposed input and the "not in" operator. The generic tag is kept if the view:
- has no bundle filter, or its filter excludes every bundle;
- has a relationship to entities of the same entity type, since those can be of any bundle;
- is not based on an entity type.
See the core issues Use new cache tag ENTITY_TYPE_list:BUNDLE in Views to improve cache hit rate and Introduce ENTITY_TYPE_list:BUNDLE cache tag.
- Type: Boolean
- Default: On, unless another module already replaces the class of the Tag based cache plugin
- Requires: Views
views_exposed_select_hide_empty
Hides selects in the exposed forms of views that have nothing to choose, and radios and checkboxes, such as from Better Exposed Filters: a filter that only offers - Any - because there is nothing to filter by yet, or a select whose only option is always used, such as a required filter or an operator with one choice. A multiple select or checkboxes with one option are kept, since selecting it still changes the results. Other modules can still change the options in their form alters, since the selects are checked once the form is built. Selects inside a filter's wrapper are also hidden, but the wrapper itself stays.
- Type: Boolean
- Default: On when the Helper module is installed, but off on sites that installed it before this helper was added
- Requires: Views
views_exposed_states_bundle_filter_fields
Shows an exposed filter on a field only when the view's exposed bundle filter, such as Content type, is set to - Any - or to a bundle that has the field, using #states. Fields that every bundle the bundle filter offers has, like the title, are always shown. When none of the selected bundles have the field, the filter is already hidden when the form loads, so it doesn't flash before #states hides it, such as after a Better Exposed Filters auto-submit. Taxonomy term filters that aren't on one field, such as Taxonomy Entity Index's Has taxonomy terms (with depth), are shown for the bundles with any field that can reference the filter's vocabulary. Together with views_exposed_states_reset, a filter that is hidden this way is also cleared.
It only applies to a bundle filter on the view's base entity type without an exposed operator. For a multiple select bundle filter, the field filter is shown while nothing is selected, or when one of the selected bundles has the field. That needs the core_states_conditions_fix helper. If it's turned off, no #states are added for a multiple select bundle filter, and an error is logged. Bundle filters shown as radios or checkboxes by Better Exposed Filters work too. Checkboxes use core #states conditions, so they don't need that helper. Filters with a relationship, filters that already have #states, and the dependent filters of Views Dependent Filters are not changed.
- Type: Boolean
- Default: On when the Helper module is installed, but off on sites that installed it before this helper was added
- Requires: Views
views_exposed_states_reset
Clears the value of an exposed filter in a view when #states hides it, such as a filter that Views Dependent Filters only shows for some values of another filter. Otherwise the hidden filter keeps its value and still filters the results. Text fields are emptied, checkboxes are unchecked, single selects go back to their first option, usually - Any -, and multiple selects have nothing selected. Radios, such as from Better Exposed Filters, go back to their - Any - option, or have nothing checked if there isn't one. Hidden inputs are left for their widget to update. Filters that depend on the reset filter are then re-evaluated. When Better Exposed Filters auto-submits the form, they aren't re-evaluated in the browser, since that would submit the form again for each reset filter. The form is submitted once, and the new form is built from the reset values.
Views Dependent Filters normally keeps a dependent filter visible while it has a value, even when its controlling filter changes. With this helper on, that condition is removed, so the dependent filter is hidden and cleared when its controlling filter no longer matches. This helper also clears filters hidden by other #states, such as views_exposed_states_bundle_filter_fields.
- Type: Boolean
- Default: On
- Requires: Views
views_fix_sort_indicator_direction
Fixes the arrow on the sorted column of tables in views in Claro, Default Admin (which replaces Claro in Drupal 11.5) and themes based on them, such as Gin. Core gives the arrow the direction the next click sorts in, so these themes show a descending arrow on a column sorted in ascending order. The text for screen readers still says what clicking the column will do. Themes that use core's table sort styles, such as Olivero and Stark, already show the right arrow and are not changed. The setting lists the themes to fix, along with their sub-themes. Add other themes that show the same arrows as Claro, or save an empty list to leave every theme as core has it:
enabled:
views_fix_sort_indicator_direction:
- claro
- default_admin
See the core issue Table sort class & indicator for active field is wrong.
- Type: Array of theme names
- Default:
claroanddefault_admin, which also covers themes based on them, such as Gin - Requires: Views
views_filter_bulk_action_options
Removes actions the user cannot perform from entity bulk forms in views, such as the Content admin view. Core lists every configured action, and the user only finds out after submitting the form. See the core issue Bulk operations lists actions that the user has no access to.
- Delete is removed if the user cannot delete any of the bundles the view can list, based on its bundle filter. "Delete own" permissions count.
- Publish and Unpublish are removed if Content Moderation is enabled and every bundle the view can list is moderated, since these actions always fail on moderated content. See the core issue Dynamically provide action plugins for every moderation state change.
- Make content sticky and Make content unsticky are removed if none of the bundles the view can list show the Sticky at top of lists field in their default form display. Promote content to front page and Remove content from front page are removed the same way for the Promoted to front page field. Since Drupal 11.3, core hides both fields unless the form display shows them (see the change record), and the actions would still change them.
Other actions are not changed.
- Type: Boolean
- Default: On
- Requires: Views