function BlockListBuilder::buildForm

Same name in other branches
  1. 9 core/modules/block/src/BlockListBuilder.php \Drupal\block\BlockListBuilder::buildForm()
  2. 8.9.x core/modules/block/src/BlockListBuilder.php \Drupal\block\BlockListBuilder::buildForm()
  3. 11.x core/modules/block/src/BlockListBuilder.php \Drupal\block\BlockListBuilder::buildForm()

Overrides FormInterface::buildForm

File

core/modules/block/src/BlockListBuilder.php, line 127

Class

BlockListBuilder
Defines a class to build a listing of block entities.

Namespace

Drupal\block

Code

public function buildForm(array $form, FormStateInterface $form_state) {
    $form['#attached']['library'][] = 'core/drupal.tableheader';
    $form['#attached']['library'][] = 'block/drupal.block';
    $form['#attached']['library'][] = 'block/drupal.block.admin';
    $form['#attributes']['class'][] = 'clearfix';
    // Build the form tree.
    $form['blocks'] = $this->buildBlocksForm();
    $form['actions'] = [
        '#tree' => FALSE,
        '#type' => 'actions',
    ];
    $form['actions']['submit'] = [
        '#type' => 'submit',
        '#value' => $this->t('Save blocks'),
        '#button_type' => 'primary',
    ];
    return $form;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.