function custom_pub_by_node_type in Custom Publishing Options 7
Returns only the custom types available for the given node type.
Parameters
$node_type: Can be either a string of the node type or an object/array with a key of 'type'.
Return value
array
3 calls to custom_pub_by_node_type()
- custom_pub_form_alter in ./
custom_pub.module - Implements hook_form_alter().
- custom_pub_node_prepare in ./
custom_pub.module - Implements hook_node_prepare().
- custom_pub_preprocess_node in ./
custom_pub.module - Implements hook_preprocess_node(). Add the custom publishing option state as a class if it is enabled, similar to core node publish states.
File
- ./
custom_pub.module, line 448 - Adds the ability to add Custom publishing options to the node Add/Edit forms.
Code
function custom_pub_by_node_type($node_type) {
$return_types = array();
if (is_object($node_type) || is_array($node_type)) {
(object) $node_type;
$node_type = $node_type->type;
}
$types = variable_get('custom_pub_types', array());
foreach ($types as $key => $type) {
if (!empty($type['node_types'][$node_type])) {
$return_types[$key] = $type;
}
}
return $return_types;
}