You are here

public function SlickForm::addBreakpoints in Slick Carousel 8.2

Handles switching the breakpoints based on the input value.

File

slick_ui/src/Form/SlickForm.php, line 934

Class

SlickForm
Extends base form for slick instance configuration form.

Namespace

Drupal\slick_ui\Form

Code

public function addBreakpoints($form, FormStateInterface $form_state) {
  if (!$form_state
    ->isValueEmpty('breakpoints')) {
    $form_state
      ->setValue('breakpoints_count', $form_state
      ->getValue('breakpoints'));
    if ($form_state
      ->getValue('breakpoints') >= 6) {
      $message = $this
        ->t('You are trying to load too many Breakpoints. Try reducing it to reasonable numbers say, between 1 to 5.');
      $this
        ->messenger()
        ->addMessage($message, 'warning');
    }
  }
  return $form['responsives']['responsive'];
}