function ds_get_field_settings in Display Suite 7
Same name and namespace in other branches
- 7.2 ds.module \ds_get_field_settings()
Get the field settings.
Parameters
$entity_type: The name of the entity.
$bundle: The name of bundle (ie, page or story for node types, profile for users)
$view_mode: The name of view mode.
5 calls to ds_get_field_settings()
- dsLayoutsStylesTests::testDStestLayouts in tests/
ds.base.test - Test selecting layouts, empty regions, classes, region to block and fields.
- ds_field_attach_view_alter in ./
ds.module - Implements hook_field_attach_view_alter().
- ds_preprocess_field in modules/
ds_extras/ ds_extras.module - Implements hook_preprocess_field().
- node_ds_search_execute in modules/
ds_search/ ds_search.module - Search on behalf of Drupal Core.
- _ds_field_ui_fields in ./
ds.field_ui.inc - Add the fields to the Field UI form.
File
- ./
ds.module, line 591 - Display Suite core functions.
Code
function ds_get_field_settings($entity_type, $bundle, $view_mode, $default = TRUE) {
static $field_settings = NULL;
if (!isset($field_settings)) {
if ($cache = cache_get('ds_field_settings')) {
$field_settings = $cache->data;
}
else {
ctools_include('export');
$ds_field_settings = ctools_export_crud_load_all('ds_field_settings');
foreach ($ds_field_settings as $layout => $layout_settings) {
if (!isset($layout_settings->settings)) {
continue;
}
foreach ($layout_settings->settings as $field => $settings) {
$field_settings[$layout_settings->entity_type][$layout_settings->bundle][$layout_settings->view_mode][$field] = $settings;
}
}
cache_set('ds_field_settings', $field_settings, 'cache');
}
}
return isset($field_settings[$entity_type][$bundle][$view_mode]) ? $field_settings[$entity_type][$bundle][$view_mode] : (isset($field_settings[$entity_type][$bundle]['default']) && $default ? $field_settings[$entity_type][$bundle]['default'] : array());
}