Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By fago on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
7.x-2.x
Introduced in version:
7.x-2.1
Issue links:
Description:
Impact for site-builders:
- There is a new module "Rules translation", which allows translating Rules configurations. There will be a translation tab when you edit your rules.
- The actions "Show a message on the site", "Set a breadcrumb" and "Send a mail" have translatable text inputs now. Contributed modules may declare further actions to be translatable too, see the notes for developers below.
- The translation module provides 2 new actions:
- Translate a text: May be used to input a text which then is translated to the configured language, e.g. the interface language or the users preferred language. The translated text is provided back as variable so it can be used with any further action.
- Select a translated value: May be used to select translatable values with the data selector, e.g. to get a translation from a translated field. The selected value is provided back as variable so it can be used with any further action.
There is a follow-up issue for simplifying that: #1478852: Make the data-selector language aware
- The translation module requires recent dev versions of the entity api and the i18n module (March 12th, 2012 or later).
Impact for developers:
All changes are just API additions and are fully backward compatible:
- Added further array keys for specifying condition/action parameters:
translatable
: A boolean to make a textual parameter translatable via the new translation module.default mode
: Allows overriding the default parameter configuration mode per parameter (select vs input) without having to use restriction.ui class
: Allows overriding the UI class, which is used to generate the configuration UI of a parameter. Defaults to the UI class of the specified data type.
See the provided API docs in rules.api.php for further details on the keys.
Translatable parameters are by default always translated to the current interface language. Actions can customize that by adding a parameter with the name 'language', as then argument values are translated to the specified language. Check the according documentation page.
- Added
hook_rules_ui_menu_alter()
to allow modules to add or alter menu items of the Rules UI. - Added docs for the new hook
hook_rules_config_defaults_rebuild()
which is provided by the updated entity API. - Added
RulesPlugin::elements()
to iterate over all elements of a Rules configuration. - Added an optional $langcode parameter to some internal API functions like
RulesPlugin::getArgument()
andRulesState::applyDataSelector()
. - Improved input evaluators to receive information about all parameters of an action/condition (BC compatible).
Impacts:
Site builders, administrators, editors
Module developers