BlockEntityOffCanvasForm::form

public BlockEntityOffCanvasForm::form(array $form, FormStateInterface $form_state)

Gets the actual form array to be built.

Overrides BlockForm::form

See also

\Drupal\Core\Entity\EntityForm::processForm()

\Drupal\Core\Entity\EntityForm::afterBuild()

File

core/modules/outside_in/src/Block/BlockEntityOffCanvasForm.php, line 37

Class

BlockEntityOffCanvasForm
Provides form for block instance forms when used in the off-canvas tray.

Namespace

Drupal\outside_in\Block

Code

public function form(array $form, FormStateInterface $form_state) {
  $form = parent::form($form, $form_state);

  // Create link to full block form.
  $query = [];
  if ($destination = $this->getRequest()->query->get('destination')) {
    $query['destination'] = $destination;
  }
  $form['advanced_link'] = [
    '#type' => 'link',
    '#title' => $this->t('Advanced options'),
    '#url' => $this->entity->toUrl('edit-form', ['query' => $query]),
    '#weight' => 1000,
  ];

  // Remove the ID and region elements.
  unset($form['id'], $form['region'], $form['settings']['admin_label']);

  return $form;
}
doc_Drupal
2016-10-29 08:47:27
Comments
Leave a Comment

Please login to continue.