Community Documentation

Action Info / Condition Info reference

Last updated November 19, 2007. Created by Amitaibu on July 4, 2007.
Edited by Michelle, webchick, fago. Log in to edit this page.

action_info / condition_info

This is a list of properties available for the elements returned in implementations of hook_action_info and hook_condition_info.

Property Possible values Default value Description Required
#label * - A human readable label for the element Yes
#module * - The name of the contributing module. Can be set to any value, as it is only used for grouping entries. Yes
#arguments see below array() An array specifying the needed arguments. No
#description * "" A text which will be displayed on the action/condition configuration page. This is intended to give some usage instructions. No
#fixed TRUE | FALSE FALSE If set to TRUE, the action or condition is used only by modules and should not be available for configuration through the UI. No

#arguments

The #arguments property specifies the arguments, that the action or conditions requires at execution time. It has to be an array of arguments, where the keys are the machine readable name of the argument and the value is another array, with the properties:

Property Possible values Default value Description Required
#label * - A human readable label for the argument Yes
#entity * - The entity type of the argument, e.g. 'node', 'user' or 'comment'. Yes

Events also specify the available arguments. So when an action / condition is configured, the arguments are mapped from the event to the action.
It's also possible to specify a '*', which means that the action can work with every entity type. Furthermore one can specify an array of possible entity types, e.g. the array array('user', 'node') would specify, that the action can work with users as well as with nodes.

Here is an example of a valid implementation of hook_action_info():

<?php
/*
* Implementation of hook_action_info()
*/
function your_module_action_info() {
  return array(
   
'your_module_action_node_set_author' => array(
     
'#label' => t('Set the content author'),
     
'#arguments' => array(
       
'node' => array('#entity' => 'node', '#label' => t('Content')),
       
'author' => array('#entity' => 'user', '#label' => t('User, which is set as author')),
      ),
     
'#module' => t('Node'),
    ),
  );
}
?>

About this page

Drupal version
Drupal 5.x
Drupal’s online documentation is © 2000-2012 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License.