You are here

public function SettingsForm::buildForm in Content Planner 8

Same name in this branch
  1. 8 modules/content_kanban/src/Form/SettingsForm.php \Drupal\content_kanban\Form\SettingsForm::buildForm()
  2. 8 modules/content_calendar/src/Form/SettingsForm.php \Drupal\content_calendar\Form\SettingsForm::buildForm()

Form constructor.

Parameters

array $form: An associative array containing the structure of the form.

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

Return value

array The form structure.

Overrides ConfigFormBase::buildForm

File

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

Class

SettingsForm
Defines a form that configures forms module settings.

Namespace

Drupal\content_calendar\Form

Code

public function buildForm(array $form, FormStateInterface $form_state, Request $request = NULL) {

  // Get select options for content types.
  $content_type_options = $this
    ->getConfiguredContentTypes();
  if (!$content_type_options) {
    $message = $this
      ->t('Content Calendar can only be used with Scheduler. At least one Content Type needs to have the scheduling options enabled.');
    $this
      ->messenger()
      ->addMessage($message, 'error');
    return [];
  }

  // Build Content Type configuration.
  $this
    ->buildContentTypeConfiguration($form, $form_state);

  // Build Calendar Options.
  $this
    ->buildCalendarOptions($form, $form_state);

  // Build form.
  $build_form = parent::buildForm($form, $form_state);
  return $build_form;
}