function commentformsettings_process_format in Node and Comments Form Settings 7.3
Same name and namespace in other branches
- 7.2 commentformsettings/commentformsettings.module \commentformsettings_process_format()
Custom callback function to process input format for all the fields.
Parameters
Array $element: The input element for which the format is to be processed.
Return value
Array Return updated element with necessary changes.
1 call to commentformsettings_process_format()
- nodeformsettings_process_format in ./
nodeformsettings.module - Custom callback function to process input format for all the fields.
1 string reference to 'commentformsettings_process_format'
- commentformsettings_element_info_alter in commentformsettings/
commentformsettings.module - Implements hook_element_info_alter().
File
- commentformsettings/
commentformsettings.module, line 312
Code
function commentformsettings_process_format($element) {
// If the filter was not already processed in nodeformsettings module,
// then process it here.
if (!module_exists('nodeformsettings')) {
$element = filter_process_format($element);
}
// Make sure we have an entity and a type here.
if (isset($element['#entity'], $element['#entity']->node_type)) {
// For comment, the '->node_type' field is available.
$type = $element['#entity']->node_type;
// For comments, the type will be 'comment_node_<content type>'
// Field of comment is 'comment_body'.
if (strpos($type, 'comment_node') !== FALSE) {
$fields = array(
'comment_body',
);
// Get settings for this node type.
$settings = commentformsettings_get_settings(str_replace('comment_node_', '', $type));
$setting = 'cfs_inputformat';
// Hide the 'text format' pane below certain text area fields.
if (isset($settings[$setting], $element['#field_name']) && count($settings) && $settings[$setting] == 1 && in_array($element['#field_name'], $fields)) {
// Set access to FALSE.
$element['format']['#access'] = FALSE;
}
}
}
return $element;
}