You are here

public function CclDeleteConfirm::buildForm in Custom Contextual Links 8

Form constructor.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form structure.

Overrides FormInterface::buildForm

File

src/Form/CclDeleteConfirm.php, line 23
Contains \Drupal\ccl\Form\CclDeleteConfirm.

Class

CclDeleteConfirm

Namespace

Drupal\ccl\Form

Code

public function buildForm(array $form, \Drupal\Core\Form\FormStateInterface $form_state, $id = NULL) {
  $form['clid'] = [
    '#type' => 'value',
    '#value' => $id,
  ];
  $title = db_query('SELECT title FROM {ccl} WHERE clid = :clid', [
    ':clid' => $id,
  ])
    ->fetchField();
  return confirm_form($form, t('Are you sure you want to delete the link %title?', [
    '%title' => $title,
  ]), 'admin/config/user-interface/ccl', t('This action cannot be undone.'), t('Delete'), t('Cancel'));
}