public EditForm::buildForm(array $form, FormStateInterface $form_state, $pid = NULL)
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 PathFormBase::buildForm
File
- core/modules/path/src/Form/EditForm.php, line 30
Class
- EditForm
- Provides the path edit form.
Namespace
Drupal\path\Form
Code
public function buildForm(array $form, FormStateInterface $form_state, $pid = NULL) {
$form = parent::buildForm($form, $form_state, $pid);
$form['#title'] = $this->path['alias'];
$form['pid'] = array(
'#type' => 'hidden',
'#value' => $this->path['pid'],
);
$url = new Url('path.delete', array(
'pid' => $this->path['pid'],
));
if ($this->getRequest()->query->has('destination')) {
$url->setOption('query', $this->getDestinationArray());
}
$form['actions']['delete'] = array(
'#type' => 'link',
'#title' => $this->t('Delete'),
'#url' => $url,
'#attributes' => array(
'class' => array('button', 'button--danger'),
),
);
return $form;
}
Please login to continue.