public function StatisticsPopularBlock::blockForm in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/statistics/src/Plugin/Block/StatisticsPopularBlock.php \Drupal\statistics\Plugin\Block\StatisticsPopularBlock::blockForm()
Returns the configuration form elements specific to this block plugin.
Blocks that need to add form elements to the normal block configuration form should implement this method.
Parameters
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.
Overrides BlockBase::blockForm
File
- core/
modules/ statistics/ src/ Plugin/ Block/ StatisticsPopularBlock.php, line 46 - Contains \Drupal\statistics\Plugin\Block\StatisticsPopularBlock.
Class
- StatisticsPopularBlock
- Provides a 'Popular content' block.
Namespace
Drupal\statistics\Plugin\BlockCode
public function blockForm($form, FormStateInterface $form_state) {
// Popular content block settings.
$numbers = array(
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
15,
20,
25,
30,
40,
);
$numbers = array(
'0' => $this
->t('Disabled'),
) + array_combine($numbers, $numbers);
$form['statistics_block_top_day_num'] = array(
'#type' => 'select',
'#title' => $this
->t("Number of day's top views to display"),
'#default_value' => $this->configuration['top_day_num'],
'#options' => $numbers,
'#description' => $this
->t('How many content items to display in "day" list.'),
);
$form['statistics_block_top_all_num'] = array(
'#type' => 'select',
'#title' => $this
->t('Number of all time views to display'),
'#default_value' => $this->configuration['top_all_num'],
'#options' => $numbers,
'#description' => $this
->t('How many content items to display in "all time" list.'),
);
$form['statistics_block_top_last_num'] = array(
'#type' => 'select',
'#title' => $this
->t('Number of most recent views to display'),
'#default_value' => $this->configuration['top_last_num'],
'#options' => $numbers,
'#description' => $this
->t('How many content items to display in "recently viewed" list.'),
);
return $form;
}