You are here

public function SlickFormBase::addBreakpoints in Slick Carousel 8

Handles switching the breakpoints based on the input value.

File

slick_ui/src/Form/SlickFormBase.php, line 271

Class

SlickFormBase
Provides base form for a 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.');
      drupal_set_message($message, 'warning');
    }
  }
  return $form['responsives']['responsive'];
}