You are here

protected function SettingsForm::buildCalendarOptions in Content Planner 8

Build the form elements for the calendar options.

Parameters

array $form:

\Drupal\Core\Form\FormStateInterface $form_state:

1 call to SettingsForm::buildCalendarOptions()
SettingsForm::buildForm in modules/content_calendar/src/Form/SettingsForm.php
Form constructor.

File

modules/content_calendar/src/Form/SettingsForm.php, line 206

Class

SettingsForm
Defines a form that configures forms module settings.

Namespace

Drupal\content_calendar\Form

Code

protected function buildCalendarOptions(array &$form, FormStateInterface $form_state) {

  // Fieldset.
  $form['options'] = [
    '#type' => 'fieldset',
    '#title' => $this
      ->t('Display Options'),
    '#collapsible' => FALSE,
    '#collapsed' => FALSE,
  ];

  // Show user thumb checkbox.
  $user_picture_field_exists = !$this
    ->config('field.field.user.user.user_picture')
    ->isNew();
  $form['options']['show_user_thumb'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Show thumbnail image of User image'),
    '#description' => $this
      ->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' => $this->config
      ->get('show_user_thumb'),
  ];
  $form['options']['bg_color_unpublished_content'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Background color for unpublished content'),
    '#description' => $this
      ->t("Define the background color for unpublished content. Use a css color in word format (e.x. red) or a hexadecimal value (e.x. #ffcc00). When empty the default value will be used."),
    '#maxlength' => 20,
    '#default_value' => $this->config
      ->get('bg_color_unpublished_content'),
  ];
}