You are here

function ds_block_field_form_submit in Display Suite 6.3

Same name and namespace in other branches
  1. 6 includes/ds.fields.inc \ds_block_field_form_submit()
  2. 6.2 includes/ds.fields.inc \ds_block_field_form_submit()

Save block field.

1 string reference to 'ds_block_field_form_submit'
ds_block_field_form in includes/ds.fields.inc
Block field form.

File

includes/ds.fields.inc, line 654
Manage fields.

Code

function ds_block_field_form_submit($form, &$form_state) {
  $module = $form['#module'];
  $fields = variable_get($module . '_fields', array());
  $key = $form_state['values']['block_key'];
  $fields[$key] = array(
    'type' => DS_FIELD_TYPE_BLOCK,
    'status' => $form['#field_status'],
    'title' => $form_state['values']['block_title'],
    'exclude' => $form_state['values']['block_exclude'],
    'properties' => array(
      'block' => $form_state['values']['block_block'],
      'render' => $form_state['values']['block_render'],
    ),
  );

  // Block class.
  if (!empty($form_state['values']['block_class'])) {
    $fields[$key]['properties']['css-class'] = $form_state['values']['block_class'];
  }

  // Safe field and invalidate cached fields.
  variable_set($module . '_fields', $fields);
  ds_reset_fields_cache();

  // Redirect and confirmation message.
  $form_state['redirect'] = DS_PATH_MODULES . '/' . $form['#module'] . '/fields';
  drupal_set_message(t('Field %field has been saved.', array(
    '%field' => $form_state['values']['block_title'],
  )));
}