You are here

function ds_field_delete_reset_form in Display Suite 6.3

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

Field delete or reset form.

Parameters

string $module The module the fields are for.:

string $object The object name (ie node, user, comment).:

string $key The key of the field.:

array $field The field with title and code keys.:

1 string reference to 'ds_field_delete_reset_form'
ds_fields in includes/ds.fields.inc
Fields overview.

File

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

Code

function ds_field_delete_reset_form($form_state, $module, $key, $field) {
  $form = array();
  $action = $field['status'] == DS_FIELD_STATUS_OVERRIDDEN ? t('reset') : t('delete');
  $form['question'] = array(
    '#type' => 'markup',
    '#value' => '<p>' . t('Are you sure you want to !action the field %field ?', array(
      '!action' => $action,
      '%field' => $field['title'],
    )) . '</p>',
  );
  $form['field'] = array(
    '#type' => 'value',
    '#value' => $key,
  );
  $form['button']['submit'] = array(
    '#prefix' => '<div>',
    '#type' => 'submit',
    '#value' => $field['status'] == DS_FIELD_STATUS_OVERRIDDEN ? t('Reset') : t('Delete'),
  );
  $form['buttons']['cancel'] = array(
    '#suffix' => '</div>',
    '#type' => 'markup',
    '#value' => l('cancel', DS_PATH_MODULES . '/' . $module . '/fields'),
  );
  $form['#module'] = $module;
  return $form;
}