function readmorecontrol_format_settings in Read More Control 7
Helper function to get any formatting settings.
3 calls to readmorecontrol_format_settings()
- readmorecontrol_admin_settings_form in ./
readmorecontrol.admin.inc - Menu callback to configure the default behaviour of the module.
- readmorecontrol_entity_view in ./
readmorecontrol.module - Extract, update or construct the read more link.
- _readmorecontrol_form_field_ui_display_overview_form_alter in ./
readmorecontrol.admin.inc - Internal implementation of hook_form_FORM_ID_alter().
File
- ./
readmorecontrol.module, line 229 - Defines options to control how the Read more link is displayed on teasers.
Code
function readmorecontrol_format_settings($entity_type, $bundle = NULL, $view_mode = NULL, $is_edit = FALSE) {
$settings = array();
if ($is_edit) {
if ($view_mode && $view_mode != 'default') {
$settings += (array) variable_get('readmorecontrol_format__' . $entity_type . '__' . $bundle . '__' . $view_mode, array(
'enabled' => 'global',
));
}
elseif ($bundle) {
$settings += (array) variable_get('readmorecontrol_format__' . $entity_type . '__' . $bundle, array(
'enabled' => 'global',
));
}
else {
$settings += (array) variable_get('readmorecontrol_format__' . $entity_type, array(
'enabled' => 'none',
));
}
}
else {
// Find the setting with the highest precesion, but discard if the use
// global setting is selected.
if ($view_mode) {
$settings += (array) variable_get('readmorecontrol_format__' . $entity_type . '__' . $bundle . '__' . $view_mode, array());
$settings += array(
'enabled' => 'global',
);
if (!$is_edit && $settings['enabled'] == 'global') {
$settings = array();
}
}
if ($bundle) {
$settings += (array) variable_get('readmorecontrol_format__' . $entity_type . '__' . $bundle, array());
$settings += array(
'enabled' => 'global',
);
if ($settings['enabled'] == 'global') {
$settings = array();
}
}
$settings += (array) variable_get('readmorecontrol_format__' . $entity_type, array(
'enabled' => 'none',
));
}
$settings += array(
'enabled' => 'none',
'text' => '',
'href' => '',
'query' => '',
'fragment' => '',
'title' => '',
'class' => '',
'rel' => '',
'target' => '',
'placement' => readmorecontrol_default_placement($entity_type, $view_mode),
);
return $settings;
}