You are here

public function FlexiformElement::removeForm in Flexiform 7

Build the remove form for the element.

File

includes/flexiform.element.inc, line 245
Controller class for flexiform elements.

Class

FlexiformElement
Base class for all FlexiformElements

Code

public function removeForm($form, &$form_state, $flexiform) {
  $form['confirm'] = array(
    '#type' => 'hidden',
    '#value' => 1,
  );
  $question = t('Are you sure you want to remove @element?', array(
    '@element' => $this
      ->label(),
  ));
  drupal_set_title($question, PASS_THROUGH);
  $form['#attributes']['class'][] = 'confirmation';
  $form['description'] = array(
    '#markup' => t('This action cannot be undone.'),
  );
  $form['actions'] = array(
    '#type' => 'actions',
  );
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Confirm'),
  );
  $form['actions']['cancel'] = array(
    '#type' => 'link',
    '#title' => t('Cancel'),
    '#href' => 'admin/structure/flexiforms/manage/' . $flexiform->form . '/form-fields',
  );
  $form['#theme'] = 'confirm_form';
  return $form;
}