class RulesNodeConditionType
Condition: Check for selected content types.
Hierarchy
- class \RulesPluginHandlerBase extends \FacesExtender implements \RulesPluginHandlerInterface
- class \RulesConditionHandlerBase extends \RulesPluginHandlerBase implements \RulesConditionHandlerInterface
- class \RulesNodeConditionBase extends \RulesConditionHandlerBase
- class \RulesNodeConditionType extends \RulesNodeConditionBase
- class \RulesNodeConditionBase extends \RulesConditionHandlerBase
- class \RulesConditionHandlerBase extends \RulesPluginHandlerBase implements \RulesConditionHandlerInterface
Expanded class hierarchy of RulesNodeConditionType
Related topics
File
-
modules/
node.eval.inc, line 32
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
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
RulesNodeConditionBase::defaults | public static | function | |
RulesNodeConditionType::assertions | public | function | Provides the content type of a node as asserted metadata. |
RulesNodeConditionType::execute | public | function | Executes the condition. |
RulesNodeConditionType::getInfo | public static | function | Defines the condition. |