You are here

public function EntityInlineEntityFormController::removeForm in Inline Entity Form 7

Returns the remove form to be shown through the IEF widget.

Parameters

$remove_form: The remove form.

$form_state: The form state of the parent form.

1 method overrides EntityInlineEntityFormController::removeForm()
CommerceLineItemInlineEntityFormController::removeForm in includes/commerce_line_item.inline_entity_form.inc
Overrides EntityInlineEntityFormController::removeForm().

File

includes/entity.inline_entity_form.inc, line 334
Defines the base inline entity form controller.

Class

EntityInlineEntityFormController
@file Defines the base inline entity form controller.

Code

public function removeForm($remove_form, &$form_state) {
  $entity = $remove_form['#entity'];
  list($entity_id) = entity_extract_ids($this->entityType, $entity);
  $entity_label = entity_label($this->entityType, $entity);
  $remove_form['message'] = array(
    '#markup' => '<div>' . t('Are you sure you want to remove %label?', array(
      '%label' => $entity_label,
    )) . '</div>',
  );
  if (!empty($entity_id) && $this
    ->getSetting('allow_existing')) {
    $access = entity_access('delete', $this->entityType, $entity);
    if ($access) {
      $labels = $this
        ->labels();
      $remove_form['delete'] = array(
        '#type' => 'checkbox',
        '#title' => t('Delete this @type_singular from the system.', array(
          '@type_singular' => $labels['singular'],
        )),
      );
    }
  }
  return $remove_form;
}