function custom_pub_types in Custom Publishing Options 7
Returns custom publish types defined in the system.
Parameters
bool $rebuild:
Return value
array
2 calls to custom_pub_types()
- custom_pub_i18n_sync_options_alter in ./
custom_pub.module - Implements hook_i18n_sync_options_alter().
- custom_pub_types_rebuild in ./
custom_pub.module - Rebuilds list of custom publish options.
23 string references to 'custom_pub_types'
- custom_pub_add_submit in ./
custom_pub.admin.inc - Submit handler
- custom_pub_add_validate in ./
custom_pub.admin.inc - Validate handler
- custom_pub_admin in ./
custom_pub.admin.inc - Callback function for Custom Publishing Options menu item.
- custom_pub_by_node_type in ./
custom_pub.module - Returns only the custom types available for the given node type.
- custom_pub_edit_submit in ./
custom_pub.admin.inc - Form submit function for the edit form.
File
- ./
custom_pub.module, line 529 - Adds the ability to add Custom publishing options to the node Add/Edit forms.
Code
function custom_pub_types($rebuild = FALSE) {
$pub_types = variable_get('custom_pub_types', array());
if ($rebuild) {
foreach (module_implements('custom_pub_defaults') as $module) {
$options_array = module_invoke($module, 'custom_pub_defaults');
foreach ($options_array as $type => $option) {
if (!isset($pub_types[$type])) {
$pub_types[$type] = $option;
if (!db_field_exists('node', $type)) {
$spec = array(
'description' => 'Custom publishing option ' . $option['name'],
'type' => 'int',
'not null' => TRUE,
'default' => 0,
);
db_add_field('node', $type, $spec);
}
}
$pub_types[$type]['default'] = TRUE;
}
}
variable_set('custom_pub_types', $pub_types);
}
return $pub_types;
}