function nd_rules_disable_fields in Node displays 6.3
Same name and namespace in other branches
- 6.2 nd.rules.inc \nd_rules_disable_fields()
Rules action callback
This action will unset a DS/ND field from the node object so it won't be displayed.
Parameters
$node: The active node.
$settings: An array of configuration set in the action callback form.
File
- ./
nd.rules.inc, line 13
Code
function nd_rules_disable_fields($node, $settings) {
$ds_fields = ds_get_fields('nd', $node->type, $node->build_mode);
$key = $settings['disable_this_field'];
$key_rendered = $key . '_rendered';
$field = $ds_fields[$settings['disable_this_field']];
switch ($field['type']) {
case DS_FIELD_TYPE_PREPROCESS:
case DS_FIELD_TYPE_IGNORE:
unset($node->{$key});
break;
case DS_FIELD_TYPE_CODE:
case DS_FIELD_TYPE_BLOCK:
case DS_FIELD_TYPE_FUNCTION:
case DS_FIELD_TYPE_THEME:
unset($node->{$key_rendered});
break;
}
}