diff --git a/core/modules/block/lib/Drupal/block/Plugin/views/display/Block.php b/core/modules/block/lib/Drupal/block/Plugin/views/display/Block.php index c427a15..e2314fd 100644 --- a/core/modules/block/lib/Drupal/block/Plugin/views/display/Block.php +++ b/core/modules/block/lib/Drupal/block/Plugin/views/display/Block.php @@ -208,17 +208,31 @@ public function submitOptionsForm(&$form, &$form_state) { } /** - * Provides the block settings form. + * Adds the configuration form elements specific to this views block plugin. + * + * This method allows block instances to override the views items_per_page and + * more_link settings. + * + * @param \Drupal\views\Plugin\Block\ViewsBlock $block + * The ViewsBlock plugin. + * @param array $form + * The form definition array for the block configuration form. + * @param array $form_state + * An array containing the current state of the configuration form. + * + * @return array $form + * The renderable form array representing the entire configuration form. + * + * @see \Drupal\views\Plugin\Block\ViewsBlock::blockForm() */ - public function blockForm(ViewsBlock $block, &$form, &$form_state) { + public function blockForm(ViewsBlock $block, array &$form, array &$form_state) { $allow_settings = array_filter($this->getOption('allow')); if (!empty($allow_settings)) { - $settings['override'] = array( + $form['override'] = array( '#type' => 'details', '#title' => t('Override settings'), - '#collapsed' => FALSE, - '#collapsible' => FALSE, + '#open' => TRUE, '#weight' => 8, ); } @@ -228,7 +242,7 @@ public function blockForm(ViewsBlock $block, &$form, &$form_state) { foreach ($allow_settings as $setting) { switch ($setting) { case 'items_per_page': - $settings['override']['items_per_page'] = array( + $form['override']['items_per_page'] = array( '#type' => 'select', '#title' => t('Items per page'), '#options' => array( @@ -242,7 +256,7 @@ public function blockForm(ViewsBlock $block, &$form, &$form_state) { ); break; case 'more_link': - $settings['override']['more_link'] = array( + $form['override']['more_link'] = array( '#type' => 'select', '#title' => t('More link'), '#options' => array( @@ -255,17 +269,35 @@ public function blockForm(ViewsBlock $block, &$form, &$form_state) { } } - return $settings; + return $form; } /** - * @todo + * Handles form validation for the views block configuration form. + * + * @param \Drupal\views\Plugin\Block\ViewsBlock $block + * The ViewsBlock plugin. + * @param array $form + * The form definition array for the block configuration form. + * @param array $form_state + * An array containing the current state of the configuration form. + * + * @see \Drupal\views\Plugin\Block\ViewsBlock::blockValidate() */ - public function blockValidate(ViewsBlock $block, $form, &$form_state) { + public function blockValidate(ViewsBlock $block, array $form, array &$form_state) { } /** - * @todo + * Handles form submission for the views block configuration form. + * + * @param \Drupal\views\Plugin\Block\ViewsBlock $block + * The ViewsBlock plugin. + * @param array $form + * The form definition array for the full block configuration form. + * @param array $form_state + * An array containing the current state of the configuration form. + * + * * @see \Drupal\views\Plugin\Block\ViewsBlock::blockSubmit() */ public function blockSubmit(ViewsBlock $block, $form, &$form_state) { if (isset($form_state['values']['items_per_page']) && $form_state['values']['items_per_page'] !== '') { @@ -277,7 +309,7 @@ public function blockSubmit(ViewsBlock $block, $form, &$form_state) { } /** - * Allow to change the display settings right before execute the block. + * Allows to change the display settings right before executing the block. */ public function preBlockBuild(ViewsBlock $block) { $block_configuration = $block->getConfig(); diff --git a/core/modules/views/lib/Drupal/views/Plugin/Block/ViewsBlock.php b/core/modules/views/lib/Drupal/views/Plugin/Block/ViewsBlock.php index 6869b91..eb61e6b 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/Block/ViewsBlock.php +++ b/core/modules/views/lib/Drupal/views/Plugin/Block/ViewsBlock.php @@ -107,8 +107,9 @@ public function blockForm($form, &$form_state) { return $this->view->display_handler->blockForm($this, $form, $form_state); } - - + /** + * {@inheritdoc} + */ public function blockValidate($form, &$form_state) { parent::blockValidate($form, $form_state); @@ -126,7 +127,7 @@ public function blockSubmit($form, &$form_state) { /** - * Implements \Drupal\block\BlockBase::blockBuild(). + * {@inheritdoc} */ protected function blockBuild() { $this->view->setDisplay($this->displayID);