updated webform, webform_localization, profile2, term_merge, search_api_saved_pages, rules, redirect, overide_node_options
This commit is contained in:
@@ -2,19 +2,20 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Documentation for hooks provided by the Rules API.
|
||||
*
|
||||
* This file contains no working PHP code; it exists to provide additional
|
||||
* documentation for doxygen as well as to document hooks in the standard
|
||||
* Drupal manner.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup rules Rules module integrations.
|
||||
*
|
||||
* Module integrations with the rules module.
|
||||
*
|
||||
* The Rules developer documentation describes how modules can integrate with
|
||||
* rules: http://drupal.org/node/298486.
|
||||
* rules: https://www.drupal.org/node/298486.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -30,7 +31,11 @@
|
||||
* placed into the file MODULENAME.rules.inc, which gets automatically included
|
||||
* when the hook is invoked.
|
||||
*
|
||||
* @return
|
||||
* However, as an alternative to implementing this hook, class based plugin
|
||||
* handlers may be provided by implementing RulesActionHandlerInterface. See
|
||||
* the interface for details.
|
||||
*
|
||||
* @return array
|
||||
* An array of information about the module's provided rules actions.
|
||||
* The array contains a sub-array for each action, with the action name as
|
||||
* the key. Actions names may only contain lowercase alpha-numeric characters
|
||||
@@ -62,7 +67,7 @@
|
||||
* - 'access callback': (optional) A callback which has to return whether the
|
||||
* currently logged in user is allowed to configure this action. See
|
||||
* rules_node_integration_access() for an example callback.
|
||||
* Each 'parameter' array may contain the following properties:
|
||||
* Each 'parameter' array may contain the following properties:
|
||||
* - label: The label of the parameter. Start capitalized. Required.
|
||||
* - type: The rules data type of the parameter, which is to be passed to the
|
||||
* action. All types declared in hook_rules_data_info() may be specified, as
|
||||
@@ -110,7 +115,7 @@
|
||||
* to clean inserted replacements; e.g. this is used by the token evaluator.
|
||||
* - wrapped: (optional) Set this to TRUE in case the data should be passed
|
||||
* wrapped. This only applies to wrapped data types, e.g. entities.
|
||||
* Each 'provides' array may contain the following properties:
|
||||
* Each 'provides' array may contain the following properties:
|
||||
* - label: The label of the variable. Start capitalized. Required.
|
||||
* - type: The rules data type of the variable. All types declared in
|
||||
* hook_rules_data_info() may be specified. Types may be parametrized e.g.
|
||||
@@ -118,21 +123,20 @@
|
||||
* - save: (optional) If this is set to TRUE, the provided variable is saved
|
||||
* by rules when the rules evaluation ends. Only possible for savable data
|
||||
* types. Defaults to FALSE.
|
||||
* The module has to provide an implementation for each action, being a
|
||||
* function named as specified in the 'base' key or for the execution callback.
|
||||
* All other possible callbacks are optional.
|
||||
* Supported action callbacks by rules are defined and documented in the
|
||||
* RulesPluginImplInterface. However any module may extend the action plugin
|
||||
* based upon a defined interface using hook_rules_plugin_info(). All methods
|
||||
* defined in those interfaces can be overridden by the action implementation.
|
||||
* The callback implementations for those interfaces may reside in any file
|
||||
* specified in hook_rules_file_info().
|
||||
*
|
||||
* The module has to provide an implementation for each action, being a
|
||||
* function named as specified in the 'base' key or for the execution callback.
|
||||
* All other possible callbacks are optional.
|
||||
* Supported action callbacks by rules are defined and documented in the
|
||||
* RulesPluginImplInterface. However any module may extend the action plugin
|
||||
* based upon a defined interface using hook_rules_plugin_info(). All methods
|
||||
* defined in those interfaces can be overridden by the action implementation.
|
||||
* The callback implementations for those interfaces may reside in any file
|
||||
* specified in hook_rules_file_info().
|
||||
*
|
||||
* @see hook_rules_file_info()
|
||||
* @see rules_action_execution_callback()
|
||||
* @see hook_rules_plugin_info()
|
||||
* @see RulesPluginImplInterface
|
||||
* @see hook_rules_file_info()
|
||||
* @see rules_action_execution_callback()
|
||||
* @see hook_rules_plugin_info()
|
||||
* @see RulesPluginImplInterface
|
||||
*/
|
||||
function hook_rules_action_info() {
|
||||
return array(
|
||||
@@ -151,6 +155,60 @@ function hook_rules_action_info() {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Define categories for Rules items, e.g. actions, conditions or events.
|
||||
*
|
||||
* Categories are similar to the previously used 'group' key in e.g.
|
||||
* hook_rules_action_info(), but have a machine name and some more optional
|
||||
* keys like a weight, or an icon.
|
||||
*
|
||||
* For best compatibility, modules may keep using the 'group' key for referring
|
||||
* to categories. However, if a 'group' key and a 'category' is given the group
|
||||
* will be treated as grouping in the given category (e.g. group "paypal" in
|
||||
* category "commerce payment").
|
||||
*
|
||||
* @return array
|
||||
* An array of information about the module's provided categories.
|
||||
* The array contains a sub-array for each category, with the category name as
|
||||
* the key. Names may only contain lowercase alpha-numeric characters
|
||||
* and underscores and should be prefixed with the providing module name.
|
||||
* Possible attributes for each sub-array are:
|
||||
* - label: The label of the category. Start capitalized. Required.
|
||||
* - weight: (optional) A weight for sorting the category. Defaults to 0.
|
||||
* - equals group: (optional) For BC, categories may be defined that equal
|
||||
* a previously used 'group'.
|
||||
* - icon: (optional) The file path of an icon to use, relative to the module
|
||||
* or specified icon path. The icon should be a transparent SVG containing
|
||||
* no colors (only #fff). See https://www.drupal.org/node/2090265 for
|
||||
* instructions on how to create a suitable icon.
|
||||
* Note that the icon is currently not used by Rules, however other UIs
|
||||
* building upon Rules (like fluxkraft) do, and future releases of Rules
|
||||
* might do as well. Consequently, the definition of an icon is optional.
|
||||
* However, if both an icon font and icon is given, the icon is preferred.
|
||||
* - icon path: (optional) The base path for the icon. Defaults to the
|
||||
* providing module's directory.
|
||||
* - icon font class: (optional) An icon font class referring to a suitable
|
||||
* icon. Icon font class names should map to the ones as defined by Font
|
||||
* Awesome, while themes might want to choose to provide another icon font.
|
||||
* See http://fortawesome.github.io/Font-Awesome/cheatsheet/.
|
||||
* - icon background color: (optional) The color used as icon background.
|
||||
* Should have a high contrast to white. Defaults to #ddd.
|
||||
*/
|
||||
function hook_rules_category_info() {
|
||||
return array(
|
||||
'rules_data' => array(
|
||||
'label' => t('Data'),
|
||||
'equals group' => t('Data'),
|
||||
'weight' => -50,
|
||||
),
|
||||
'fluxtwitter' => array(
|
||||
'label' => t('Twitter'),
|
||||
'icon font class' => 'icon-twitter',
|
||||
'icon font background color' => '#30a9fd',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify files containing rules integration code.
|
||||
*
|
||||
@@ -163,13 +221,34 @@ function hook_rules_action_info() {
|
||||
* plugin method callbacks in any file without having to care about file
|
||||
* inclusion.
|
||||
*
|
||||
* @return
|
||||
* @return array
|
||||
* An array of file names without the file ending which defaults to '.inc'.
|
||||
*/
|
||||
function hook_rules_file_info() {
|
||||
return array('yourmodule.rules-eval');
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies directories for class-based plugin handler discovery.
|
||||
*
|
||||
* Implementing this hook is not a requirement, it is just one option to load
|
||||
* the files containing the classes during discovery - see
|
||||
* rules_discover_plugins().
|
||||
*
|
||||
* @return string|array
|
||||
* A directory relative to the module directory, which holds the files
|
||||
* containing rules plugin handlers, or multiple directories keyed by the
|
||||
* module the directory is contained in.
|
||||
* All files in those directories having a 'php' or 'inc' file extension will
|
||||
* be loaded during discovery. Optionally, wildcards ('*') may be used to
|
||||
* match multiple directories.
|
||||
*
|
||||
* @see rules_discover_plugins()
|
||||
*/
|
||||
function hook_rules_directory() {
|
||||
return 'lib/Drupal/fluxtwitter/Rules/*';
|
||||
}
|
||||
|
||||
/**
|
||||
* The execution callback for an action.
|
||||
*
|
||||
@@ -180,10 +259,11 @@ function hook_rules_file_info() {
|
||||
* The callback gets arguments passed as described as parameter in
|
||||
* hook_rules_action_info() as well as an array containing the action's
|
||||
* configuration settings.
|
||||
* @return
|
||||
* The action may return an array containg parameter or provided variables
|
||||
*
|
||||
* @return array
|
||||
* The action may return an array containing parameter or provided variables
|
||||
* with their names as key. This is used update the value of a parameter or to
|
||||
* provdide the value for a provided variable.
|
||||
* provide the value for a provided variable.
|
||||
* Apart from that any parameters which have the key 'save' set to TRUE will
|
||||
* be remembered to be saved by rules unless the action returns FALSE.
|
||||
* Conditions have to return a boolean value in any case.
|
||||
@@ -203,6 +283,10 @@ function rules_action_execution_callback($node, $title, $settings) {
|
||||
* placed into the file MODULENAME.rules.inc, which gets automatically included
|
||||
* when the hook is invoked.
|
||||
*
|
||||
* However, as an alternative to implementing this hook, class based plugin
|
||||
* handlers may be provided by implementing RulesConditionHandlerInterface. See
|
||||
* the interface for details.
|
||||
*
|
||||
* Adding conditions works exactly the same way as adding actions, with the
|
||||
* exception that conditions can't provide variables and cannot save parameters.
|
||||
* Thus the 'provides' attribute is not supported. Furthermore the condition
|
||||
@@ -234,7 +318,11 @@ function hook_rules_condition_info() {
|
||||
* usually it's invoked directly from the providing module but wrapped by a
|
||||
* module_exists('rules') check.
|
||||
*
|
||||
* @return
|
||||
* However, as an alternative to implementing this hook, class based event
|
||||
* handlers may be provided by implementing RulesEventHandlerInterface. See
|
||||
* the interface for details.
|
||||
*
|
||||
* @return array
|
||||
* An array of information about the module's provided rules events. The array
|
||||
* contains a sub-array for each event, with the event name as the key. The
|
||||
* name may only contain lower case alpha-numeric characters and underscores
|
||||
@@ -244,13 +332,18 @@ function hook_rules_condition_info() {
|
||||
* - group: A group for this element, used for grouping the events in the
|
||||
* interface. Should start with a capital letter and be translated.
|
||||
* Required.
|
||||
* - 'access callback': An callback, which has to return whether the
|
||||
* - class: (optional) An event handler class implementing the
|
||||
* RulesEventHandlerInterface. If none is specified the
|
||||
* RulesEventDefaultHandler class will be used. While the default event
|
||||
* handler has no settings, custom event handlers may be implemented to
|
||||
* to make an event configurable. See RulesEventHandlerInterface.
|
||||
* - access callback: (optional) An callback, which has to return whether the
|
||||
* currently logged in user is allowed to configure rules for this event.
|
||||
* Access should be only granted, if the user at least may access all the
|
||||
* variables provided by the event. Optional.
|
||||
* - help: A help text for rules reaction on this event.
|
||||
* - variables: An array describing all variables that are available for
|
||||
* elements reaction on this event. Optional. Each variable has to be
|
||||
* variables provided by the event.
|
||||
* - help: (optional) A help text for rules reaction on this event.
|
||||
* - variables: (optional) An array describing all variables that are
|
||||
* available for elements reacting on this event. Each variable has to be
|
||||
* described by a sub-array with the possible attributes:
|
||||
* - label: The label of the variable. Start capitalized. Required.
|
||||
* - type: The rules data type of the variable. All types declared in
|
||||
@@ -262,17 +355,17 @@ function hook_rules_condition_info() {
|
||||
* - 'options list': (optional) A callback that returns an array of possible
|
||||
* values for this variable as specified for entity properties at
|
||||
* hook_entity_property_info().
|
||||
* - 'skip save': If the variable is saved after the event has occurred
|
||||
* anyway, set this to TRUE. So rules won't save the variable a second
|
||||
* time. Optional, defaults to FALSE.
|
||||
* - handler: A handler to load the actual variable value. This is useful
|
||||
* for lazy loading variables. The handler gets all so far available
|
||||
* variables passed in the order as defined. Optional. Also see
|
||||
* http://drupal.org/node/884554.
|
||||
* - 'skip save': (optional) If the variable is saved after the event has
|
||||
* occurred anyway, set this to TRUE. So rules won't save the variable a
|
||||
* second time. Defaults to FALSE.
|
||||
* - handler: (optional) A handler to load the actual variable value. This
|
||||
* is useful for lazy loading variables. The handler gets all so far
|
||||
* available variables passed in the order as defined. Also see
|
||||
* https://www.drupal.org/node/884554.
|
||||
* Note that for lazy-loading entities just the entity id may be passed
|
||||
* as variable value, so a handler is not necessary in that case.
|
||||
*
|
||||
* @see rules_invoke_event()
|
||||
* @see rules_invoke_event()
|
||||
*/
|
||||
function hook_rules_event_info() {
|
||||
$items = array(
|
||||
@@ -321,8 +414,7 @@ function hook_rules_event_info() {
|
||||
* module.
|
||||
* For a list of data types defined by rules see rules_rules_core_data_info().
|
||||
*
|
||||
*
|
||||
* @return
|
||||
* @return array
|
||||
* An array of information about the module's provided data types. The array
|
||||
* contains a sub-array for each data type, with the data type name as the
|
||||
* key. The name may only contain lower case alpha-numeric characters and
|
||||
@@ -338,7 +430,9 @@ function hook_rules_event_info() {
|
||||
* configuration UI to configure parameters of this type. The given class
|
||||
* must extend RulesDataUI and may implement the
|
||||
* RulesDataDirectInputFormInterface in order to allow the direct data input
|
||||
* configuration mode. Defaults to RulesDataUI.
|
||||
* configuration mode. For supporting selecting values from options lists,
|
||||
* the UI class may implement RulesDataInputOptionsListInterface also.
|
||||
* Defaults to RulesDataUI.
|
||||
* - wrap: (optional) If set to TRUE, the data is wrapped internally using
|
||||
* wrappers provided by the entity API module. This is required for entities
|
||||
* and data structures to support selecting a property via the data selector
|
||||
@@ -352,7 +446,7 @@ function hook_rules_event_info() {
|
||||
* makes use of the class for wrapping the data of the given type. However
|
||||
* note that if data is already wrapped when it is passed to Rules, the
|
||||
* existing wrappers will be kept.
|
||||
* For modules implementing identifiable data types being non-entites the
|
||||
* For modules implementing identifiable data types being non-entities the
|
||||
* class RulesIdentifiableDataWrapper is provided, which can be used as base
|
||||
* for a custom wrapper class. See RulesIdentifiableDataWrapper for details.
|
||||
* - property info: (optional) May be used for non-entity data structures to
|
||||
@@ -376,9 +470,9 @@ function hook_rules_event_info() {
|
||||
* - cleaning callback: (optional) A callback that input evaluators may use
|
||||
* to clean inserted replacements; e.g. this is used by the token evaluator.
|
||||
*
|
||||
* @see entity_metadata_wrapper()
|
||||
* @see hook_rules_data_info_alter()
|
||||
* @see rules_rules_core_data_info()
|
||||
* @see entity_metadata_wrapper()
|
||||
* @see hook_rules_data_info_alter()
|
||||
* @see rules_rules_core_data_info()
|
||||
*/
|
||||
function hook_rules_data_info() {
|
||||
return array(
|
||||
@@ -403,7 +497,7 @@ function hook_rules_data_info() {
|
||||
* A rules configuration may consist of elements being instances of any rules
|
||||
* plugin. This hook can be used to define new or to extend rules plugins.
|
||||
*
|
||||
* @return
|
||||
* @return array
|
||||
* An array of information about the module's provided rules plugins. The
|
||||
* array contains a sub-array for each plugin, with the plugin name as the
|
||||
* key. The name may only contain lower case alpha-numeric characters,
|
||||
@@ -449,8 +543,8 @@ function hook_rules_data_info() {
|
||||
* of the 'or' plugin. Note that only uppercase values are allowed, as
|
||||
* lower case values are treated as action or condition exports.
|
||||
*
|
||||
* @see class RulesPlugin
|
||||
* @see hook_rules_plugin_info_alter()
|
||||
* @see RulesPlugin
|
||||
* @see hook_rules_plugin_info_alter()
|
||||
*/
|
||||
function hook_rules_plugin_info() {
|
||||
return array(
|
||||
@@ -489,7 +583,7 @@ function hook_rules_plugin_info() {
|
||||
* and help() could be overridden in order to control access permissions or to
|
||||
* provide some usage help.
|
||||
*
|
||||
* @return
|
||||
* @return array
|
||||
* An array of information about the module's provided input evaluators. The
|
||||
* array contains a sub-array for each evaluator, with the evaluator name as
|
||||
* the key. The name may only contain lower case alpha-numeric characters and
|
||||
@@ -503,8 +597,8 @@ function hook_rules_plugin_info() {
|
||||
* used. Defaults to 'text'. Multiple data types may be specified using an
|
||||
* array.
|
||||
*
|
||||
* @see class RulesDataInputEvaluator
|
||||
* @see hook_rules_evaluator_info_alter()
|
||||
* @see RulesDataInputEvaluator
|
||||
* @see hook_rules_evaluator_info_alter()
|
||||
*/
|
||||
function hook_rules_evaluator_info() {
|
||||
return array(
|
||||
@@ -512,7 +606,7 @@ function hook_rules_evaluator_info() {
|
||||
'class' => 'RulesTokenEvaluator',
|
||||
'type' => array('text', 'uri'),
|
||||
'weight' => 0,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -527,7 +621,7 @@ function hook_rules_evaluator_info() {
|
||||
* access() could be overridden in order to provide a configuration form or
|
||||
* to control access permissions.
|
||||
*
|
||||
* @return
|
||||
* @return array
|
||||
* An array of information about the module's provided data processors. The
|
||||
* array contains a sub-array for each processor, with the processor name as
|
||||
* the key. The name may only contain lower case alpha-numeric characters and
|
||||
@@ -542,8 +636,8 @@ function hook_rules_evaluator_info() {
|
||||
* used. Defaults to 'text'. Multiple data types may be specified using an
|
||||
* array.
|
||||
*
|
||||
* @see class RulesDataProcessor
|
||||
* @see hook_rules_data_processor_info_alter()
|
||||
* @see RulesDataProcessor
|
||||
* @see hook_rules_data_processor_info_alter()
|
||||
*/
|
||||
function hook_rules_data_processor_info() {
|
||||
return array(
|
||||
@@ -551,7 +645,7 @@ function hook_rules_data_processor_info() {
|
||||
'class' => 'RulesDateOffsetProcessor',
|
||||
'type' => 'date',
|
||||
'weight' => -2,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -564,10 +658,10 @@ function hook_rules_data_processor_info() {
|
||||
* @param $actions
|
||||
* The items of all modules as returned from hook_rules_action_info().
|
||||
*
|
||||
* @see hook_rules_action_info().
|
||||
* @see hook_rules_action_info()
|
||||
*/
|
||||
function hook_rules_action_info_alter(&$actions) {
|
||||
// The rules action is more powerful, so hide the core action
|
||||
// The rules action is more powerful, so hide the core action.
|
||||
unset($actions['rules_core_node_assign_owner_action']);
|
||||
// We prefer handling saving by rules - not by the user.
|
||||
unset($actions['rules_core_node_save_action']);
|
||||
@@ -597,7 +691,7 @@ function hook_rules_condition_info_alter(&$conditions) {
|
||||
* @param $events
|
||||
* The items of all modules as returned from hook_rules_event_info().
|
||||
*
|
||||
* @see hook_rules_event_info().
|
||||
* @see hook_rules_event_info()
|
||||
*/
|
||||
function hook_rules_event_info_alter(&$events) {
|
||||
// Change events.
|
||||
@@ -669,7 +763,7 @@ function hook_rules_data_processor_info_alter(&$processor_info) {
|
||||
* This hook is invoked during rules configuration loading, which is handled
|
||||
* by entity_load(), via classes RulesEntityController and EntityCRUDController.
|
||||
*
|
||||
* @param $configs
|
||||
* @param array $configs
|
||||
* An array of rules configurations being loaded, keyed by id.
|
||||
*/
|
||||
function hook_rules_config_load($configs) {
|
||||
@@ -707,7 +801,7 @@ function hook_rules_config_insert($config) {
|
||||
* The rules configuration that is being inserted or updated.
|
||||
*/
|
||||
function hook_rules_config_presave($config) {
|
||||
if ($config->id && $config->module == 'yours') {
|
||||
if ($config->id && $config->owner == 'your_module') {
|
||||
// Add custom condition.
|
||||
$config->conditon(/* Your condition */);
|
||||
}
|
||||
@@ -763,7 +857,7 @@ function hook_rules_config_execute($config) {
|
||||
* should be placed into the file MODULENAME.rules_defaults.inc, which gets
|
||||
* automatically included when the hook is invoked.
|
||||
*
|
||||
* @return
|
||||
* @return array
|
||||
* An array of rules configurations with the configuration names as keys.
|
||||
*
|
||||
* @see hook_default_rules_configuration_alter()
|
||||
@@ -772,6 +866,8 @@ function hook_rules_config_execute($config) {
|
||||
function hook_default_rules_configuration() {
|
||||
$rule = rules_reaction_rule();
|
||||
$rule->label = 'example default rule';
|
||||
// Add rules tags.
|
||||
$rule->tags = array('Admin', 'Tag2');
|
||||
$rule->active = FALSE;
|
||||
$rule->event('node_update')
|
||||
->condition(rules_condition('data_is', array('data:select' => 'node:status', 'value' => TRUE))->negate())
|
||||
@@ -779,6 +875,7 @@ function hook_default_rules_configuration() {
|
||||
->action('drupal_message', array('message' => 'A node has been updated.'));
|
||||
|
||||
$configs['rules_test_default_1'] = $rule;
|
||||
|
||||
return $configs;
|
||||
}
|
||||
|
||||
@@ -806,10 +903,10 @@ function hook_default_rules_configuration_alter(&$configs) {
|
||||
* This hook is invoked by the entity module after default rules configurations
|
||||
* have been rebuilt; i.e. defaults have been saved to the database.
|
||||
*
|
||||
* @param $rules_configs
|
||||
* @param array $rules_configs
|
||||
* The array of default rules configurations which have been inserted or
|
||||
* updated, keyed by name.
|
||||
* @param $originals
|
||||
* @param array $originals
|
||||
* An array of original rules configurations keyed by name; i.e. the rules
|
||||
* configurations before the current defaults have been applied. For inserted
|
||||
* rules configurations no original is available.
|
||||
@@ -888,7 +985,8 @@ function hook_rules_event_set_alter($event_name, RulesEventSet $event_set) {
|
||||
* @param $element
|
||||
* The element array of a configured condition or action which is to be
|
||||
* upgraded.
|
||||
* @return
|
||||
*
|
||||
* @return string
|
||||
* The name of the action or condition which should be used.
|
||||
*/
|
||||
function hook_rules_action_base_upgrade_map_name($element) {
|
||||
@@ -896,13 +994,13 @@ function hook_rules_action_base_upgrade_map_name($element) {
|
||||
}
|
||||
|
||||
/**
|
||||
* D6 to D7 upgrade procedure hook for mapping action or condition configuration.
|
||||
* D6 to D7 upgrade process hook for mapping action or condition configuration.
|
||||
*
|
||||
* During upgrading Drupal 6 rule configurations to Drupal 7 Rules is taking
|
||||
* care of upgrading the configuration of all known parameters, which only works
|
||||
* if the parameter name has not changed.
|
||||
* If something changed, this callback can be used to properly apply the
|
||||
* configruation of the Drupal 6 action ($element) to the Drupal 7 version
|
||||
* configuration of the Drupal 6 action ($element) to the Drupal 7 version
|
||||
* ($target).
|
||||
*
|
||||
* This is no real hook, but a callback that is invoked for each Drupal 6
|
||||
@@ -924,7 +1022,7 @@ function hook_rules_action_base_upgrade($element, RulesPlugin $target) {
|
||||
}
|
||||
|
||||
/**
|
||||
* D6 to D7 upgrade procedure hook for mapping action or condition configuration.
|
||||
* D6 to D7 upgrade process hook for mapping action or condition configuration.
|
||||
*
|
||||
* A alter hook that is called after the action/condition specific callback for
|
||||
* each element of a configuration that is upgraded.
|
||||
@@ -967,6 +1065,39 @@ function hook_rules_ui_menu_alter(&$items, $base_path, $base_count) {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Control access to Rules configurations.
|
||||
*
|
||||
* Modules may implement this hook if they want to have a say in whether or not
|
||||
* a given user has access to perform a given operation on a Rules
|
||||
* configuration.
|
||||
*
|
||||
* @param string $op
|
||||
* The operation being performed. One of 'view', 'create', 'update' or
|
||||
* 'delete'.
|
||||
* @param $rules_config
|
||||
* (optional) A Rules configuration to check access for. If nothing is given,
|
||||
* access for all Rules configurations is determined.
|
||||
* @param $account
|
||||
* (optional) The user to check for. If no account is passed, access is
|
||||
* determined for the current user.
|
||||
*
|
||||
* @return bool|null
|
||||
* Return TRUE to grant access, FALSE to explicitly deny access. Return NULL
|
||||
* or nothing to not affect the operation.
|
||||
* Access is granted as soon as a module grants access and no one denies
|
||||
* access. Thus if no module explicitly grants access, access will be denied.
|
||||
*
|
||||
* @see rules_config_access()
|
||||
*/
|
||||
function hook_rules_config_access($op, $rules_config = NULL, $account = NULL) {
|
||||
// Instead of returning FALSE return nothing, so others still can grant
|
||||
// access.
|
||||
if (isset($rules_config) && $rules_config->owner == 'mymodule' && user_access('my modules permission')) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
Reference in New Issue
Block a user