public function Block::blockForm in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/views/src/Plugin/views/display/Block.php \Drupal\views\Plugin\views\display\Block::blockForm()
Adds the configuration form elements specific to this views block plugin.
This method allows block instances to override the views items_per_page.
Parameters
\Drupal\views\Plugin\Block\ViewsBlock $block: The ViewsBlock plugin.
array $form: The form definition array for the block configuration form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array $form The renderable form array representing the entire configuration form.
See also
\Drupal\views\Plugin\Block\ViewsBlock::blockForm()
File
- core/
modules/ views/ src/ Plugin/ views/ display/ Block.php, line 273 - Contains \Drupal\views\Plugin\views\display\Block.
Class
- Block
- The plugin that handles a block.
Namespace
Drupal\views\Plugin\views\displayCode
public function blockForm(ViewsBlock $block, array &$form, FormStateInterface $form_state) {
$allow_settings = array_filter($this
->getOption('allow'));
$block_configuration = $block
->getConfiguration();
foreach ($allow_settings as $type => $enabled) {
if (empty($enabled)) {
continue;
}
switch ($type) {
case 'items_per_page':
$form['override']['items_per_page'] = array(
'#type' => 'select',
'#title' => $this
->t('Items per block'),
'#options' => array(
'none' => $this
->t('@count (default setting)', array(
'@count' => $this
->getPlugin('pager')
->getItemsPerPage(),
)),
5 => 5,
10 => 10,
20 => 20,
40 => 40,
),
'#default_value' => $block_configuration['items_per_page'],
);
break;
}
}
return $form;
}