function fb_instant_articles_display_field_valid in Facebook Instant Articles 7.2
Same name and namespace in other branches
- 7 modules/fb_instant_articles_display/includes/view_mode_layout.inc \fb_instant_articles_display_field_valid()
Checks if we need to save anything for this field.
1 call to fb_instant_articles_display_field_valid()
- fb_instant_articles_display_field_ui_layouts_save in modules/
fb_instant_articles_display/ includes/ view_mode_layout.inc - Saves layout configuration of Facebook Instant Articles Display View Mode.
File
- modules/
fb_instant_articles_display/ includes/ view_mode_layout.inc, line 241 - View mode layout functions for Facebook Instant Articles Display.
Code
function fb_instant_articles_display_field_valid($key, $field, &$form_state, $view_mode = 'default') {
$continue = FALSE;
// Ignore the Field group module and the region to block plugin.
if ($key == '_add_new_group' || $key == '_add_new_field' || $key == '_add_new_block_region') {
$continue = TRUE;
}
// If the field is in hidden region, do not save. Check if the
// field has a type key which means it's from Field API and
// we need to reset that type to 'hidden' so it doesn't get
// fired by Field API in the frontend.
if (isset($field['region']) && $field['region'] == 'hidden') {
if (isset($field['type']) && $view_mode != 'form') {
$form_state['values']['fields'][$key]['type'] = 'hidden';
}
// In case of a form, fields will be set with #access to FALSE.
if ($view_mode != 'form') {
$continue = TRUE;
}
}
return $continue;
}