function eva_plugin_display_entity::options_submit in EVA: Entity Views Attachment 7
Perform any necessary changes to the form values prior to storage.
There is no need for this function to actually store the data.
Overrides views_plugin_display::options_submit
File
- ./
eva_plugin_display_entity.inc, line 219
Class
- eva_plugin_display_entity
- The plugin that handles entity-attached views.
Code
function options_submit(&$form, &$form_state) {
// It is very important to call the parent function here:
parent::options_submit($form, $form_state);
switch ($form_state['section']) {
case 'entity_type':
$new_entity = $form_state['values']['entity_type'];
$old_entity = $this
->get_option('entity_type');
$this
->set_option('entity_type', $new_entity);
if ($new_entity != $old_entity) {
// Each entity has its own list of bundles and view modes. If there's
// only one on the new type, we can select it automatically. Otherwise
// we need to wipe the options and start over.
$new_entity_info = entity_get_info($new_entity);
$new_bundle_keys = array_keys($new_entity_info['bundles']);
$new_bundles = array();
if (count($new_bundle_keys) == 1) {
$new_bundles[] = $new_bundle_keys[0];
}
$this
->set_option('bundles', $new_bundles);
}
break;
case 'bundles':
$this
->set_option('bundles', array_values(array_filter($form_state['values']['bundles'])));
break;
case 'show_on':
$this
->set_option('show_on', $form_state['values']['show_on']);
break;
case 'arguments':
$this
->set_option('argument_mode', $form_state['values']['argument_mode']);
if ($form_state['values']['argument_mode'] == 'token') {
$this
->set_option('default_argument', $form_state['values']['default_argument']);
}
else {
$this
->set_option('default_argument', NULL);
}
break;
case 'show_title':
$this
->set_option('show_title', $form_state['values']['show_title']);
break;
case 'exposed_form_as_field':
$this
->set_option('exposed_form_as_field', $form_state['values']['exposed_form_as_field']);
break;
}
}