You are here

public function RecentKanbanActivities::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_kanban/src/Plugin/DashboardBlock/RecentKanbanActivities.php, line 74

Class

RecentKanbanActivities
Provides a user block for Content Planner Dashboard.

Namespace

Drupal\content_kanban\Plugin\DashboardBlock

Code

public function getConfigSpecificFormFields(FormStateInterface &$form_state, Request &$request, array $block_configuration) {
  $form = [];
  $limit_default_value = $this
    ->getCustomConfigByKey($block_configuration, 'limit', $this->defaultLimit);

  // Limit.
  $form['limit'] = [
    '#type' => 'number',
    '#title' => t('Quantity'),
    '#required' => TRUE,
    '#default_value' => $limit_default_value,
  ];
  $user_picture_field_exists = !\Drupal::config('field.field.user.user.user_picture')
    ->isNew();
  $show_user_thumb_default_value = $limit_default_value = $this
    ->getCustomConfigByKey($block_configuration, 'show_user_thumb', 0);
  $form['show_user_thumb'] = [
    '#type' => 'checkbox',
    '#title' => t('Show thumbnail image of User image'),
    '#description' => t('This option is only available, if the User account has the "user_picture" field. See Account configuration.'),
    '#disabled' => !$user_picture_field_exists,
    '#default_value' => $show_user_thumb_default_value,
  ];
  return $form;
}