You are here

function insert_colorbox_insert_config_form in Insert 8.2

Implements hook_insert_config_form().

File

modules/insert_colorbox/insert_colorbox.module, line 15

Code

function insert_colorbox_insert_config_form(array $form) {
  $config = \Drupal::config('insert_colorbox.config');
  $form['insert_colorbox'] = [
    '#type' => 'fieldset',
    '#title' => t('Insert Colorbox'),
  ];
  $stylesList = _insert_colorbox_styles();
  $stylesList = InsertUtility::stylesListToOptions($stylesList);
  $form['insert_colorbox']['insert_colorbox__style'] = [
    '#type' => 'select',
    '#title' => t('Image style'),
    '#options' => array_merge([
      '0' => t('use “Link image to” widget setting'),
    ], $stylesList),
    '#default_value' => $config
      ->get('style'),
    '#description' => t('Select which image style to use for viewing images in the colorbox.'),
  ];
  $form['insert_colorbox']['insert_colorbox__gallery'] = [
    '#type' => 'radios',
    '#title' => t('Gallery'),
    '#description' => t('Select whether images placed with Insert be grouped in one or more colorbox galleries or if images shall open individual colorboxes.'),
    '#options' => [
      'post' => t('Per post gallery'),
      'page' => t('Per page gallery'),
      'field_post' => t('Per field in post gallery'),
      'field_page' => t('Per field in page gallery'),
      '0' => t('No gallery'),
    ],
    '#default_value' => $config
      ->get('gallery'),
  ];
  return $form;
}