You are here

public function RecentCalendarPublicationsBlock::getConfigSpecificFormFields in Content Planner 8

Add additonal form elements specific to the Plugin.

Parameters

\Drupal\Core\Form\FormStateInterface $form_state: The form state.

\Symfony\Component\HttpFoundation\Request $request: The request.

array $block_configuration: The block configuration.

Return value

mixed Gets the config form fields.

Overrides DashboardBlockBase::getConfigSpecificFormFields

File

modules/content_calendar/src/Plugin/DashboardBlock/RecentCalendarPublicationsBlock.php, line 47

Class

RecentCalendarPublicationsBlock
Provides a block with recent calendar publications for Content Planner Dashboard.

Namespace

Drupal\content_calendar\Plugin\DashboardBlock

Code

public function getConfigSpecificFormFields(FormStateInterface &$form_state, Request &$request, array $block_configuration) {
  $form = [];

  // Last publications limit.
  $last_publications_limit_default_value = $this
    ->getCustomConfigByKey($block_configuration, 'last_publications_limit', 3);
  $form['last_publications_limit'] = [
    '#type' => 'number',
    '#title' => t('Limit number of recently published nodes'),
    '#required' => FALSE,
    '#default_value' => $last_publications_limit_default_value,
  ];

  // Next publications limit.
  $next_publications_limit_default_value = $this
    ->getCustomConfigByKey($block_configuration, 'next_publications_limit', 3);
  $form['next_publications_limit'] = [
    '#type' => 'number',
    '#title' => t('Limit number of nodes to be published'),
    '#required' => FALSE,
    '#default_value' => $next_publications_limit_default_value,
  ];
  return $form;
}