class RulesNodeConditionType in Rules 7.2
Condition: Check for selected content types.
Hierarchy
- class \RulesPluginHandlerBase extends \FacesExtender implements RulesPluginHandlerInterface
- class \RulesConditionHandlerBase implements RulesConditionHandlerInterface
- class \RulesNodeConditionBase
- class \RulesNodeConditionType
- class \RulesNodeConditionBase
- class \RulesConditionHandlerBase implements RulesConditionHandlerInterface
Expanded class hierarchy of RulesNodeConditionType
Related topics
File
- modules/
node.eval.inc, line 32 - Contains rules integration for the node module needed during evaluation.
View source
class RulesNodeConditionType extends RulesNodeConditionBase {
/**
* Defines the condition.
*/
public static function getInfo() {
$info = self::defaults() + array(
'name' => 'node_is_of_type',
'label' => t('Content is of type'),
'help' => t('Evaluates to TRUE if the given content is of one of the selected content types.'),
);
$info['parameter']['type'] = array(
'type' => 'list<text>',
'label' => t('Content types'),
'options list' => 'node_type_get_names',
'description' => t('The content type(s) to check for.'),
'restriction' => 'input',
);
return $info;
}
/**
* Executes the condition.
*/
public function execute($node, $types) {
return in_array($node->type, $types);
}
/**
* Provides the content type of a node as asserted metadata.
*/
public function assertions() {
return array(
'node' => array(
'bundle' => $this->element->settings['type'],
),
);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
RulesNodeConditionBase:: |
public static | function | ||
RulesNodeConditionType:: |
public | function |
Provides the content type of a node as asserted metadata. Overrides RulesPluginHandlerBase:: |
|
RulesNodeConditionType:: |
public | function | Executes the condition. | |
RulesNodeConditionType:: |
public static | function | Defines the condition. | |
RulesPluginHandlerBase:: |
protected | property | ||
RulesPluginHandlerBase:: |
public | function |
Implements RulesPluginImplInterface::access(). Overrides RulesPluginHandlerInterface:: |
|
RulesPluginHandlerBase:: |
public | function |
Returns an array of required modules. Overrides RulesPluginHandlerInterface:: |
|
RulesPluginHandlerBase:: |
public | function |
Alters the generated configuration form of the element. Overrides RulesPluginHandlerInterface:: |
|
RulesPluginHandlerBase:: |
public | function |
Allows altering of the element's action/condition info. Overrides RulesPluginHandlerInterface:: |
|
RulesPluginHandlerBase:: |
public | function |
Processes settings independent from a form submission. Overrides RulesPluginHandlerInterface:: |
|
RulesPluginHandlerBase:: |
public | function |
Validates $settings independent from a form submission. Overrides RulesPluginHandlerInterface:: |
|
RulesPluginHandlerBase:: |
public | function | Overridden to provide $this->element to make the code more meaningful. |