function _signature_forum_active_content_types in Signatures for Forums 7
Get a list of content types that have signatures enabled.
Return value
An array. Keys are machine names. Values are display names.
1 call to _signature_forum_active_content_types()
- signature_forum_form_user_admin_settings_alter in ./
signature_forum.module - Alter the account settings form.
File
- ./
signature_forum.module, line 385 - Tweaks signatures in ways inspired by other traditional forum software:
Code
function _signature_forum_active_content_types() {
static $static_cache = NULL;
if ($static_cache === NULL) {
$static_cache = array();
$entities = entity_get_info();
foreach ($entities['node']['bundles'] as $node_bundle_name => $node_bundle) {
// Check if the signature is displayed in any of the bundles view modes.
foreach ($entities['node']['view modes'] as $node_view_mode_name => $node_view_mode_settings) {
$extra_fields = field_extra_fields_get_display('node', $node_bundle_name, $node_view_mode_name);
if (isset($extra_fields['signature_forum']) && !empty($extra_fields['signature_forum']['visible'])) {
$static_cache[$node_bundle_name] = $node_bundle['label'];
break;
}
}
// Check if the signature is displayed in any of the comment view modes.
if (!isset($static_cache[$node_bundle_name]) && isset($entities['comment'])) {
foreach ($entities['comment']['view modes'] as $comment_view_mode_name => $comment_view_mode_settings) {
$comment_bundle_name = 'comment_node_' . $node_bundle_name;
$extra_fields = field_extra_fields_get_display('comment', $comment_bundle_name, $comment_view_mode_name);
if (isset($extra_fields['signature_forum']) && !empty($extra_fields['signature_forum']['visible'])) {
$static_cache[$node_bundle_name] = $node_bundle['label'];
break;
}
}
}
}
}
return $static_cache;
}