You are here

function hook_masonry_options_form_alter in Masonry API 8

Same name and namespace in other branches
  1. 7.3 masonry.api.php \hook_masonry_options_form_alter()
  2. 7.2 masonry.api.php \hook_masonry_options_form_alter()

Alter the Masonry options form. This allows you to define UI configuration for a custom configuration.

Parameters

$form: A form array.

$default_values: An array of default form values.

See also

hook_masonry_default_options_alter().

1 invocation of hook_masonry_options_form_alter()
MasonryService::buildSettingsForm in src/Services/MasonryService.php
Build the masonry setting configuration form.

File

./masonry.api.php, line 31
Hooks provided by Masonry.

Code

function hook_masonry_options_form_alter(&$form, $default_values) {

  // Add form item for easing option
  $form['layoutAnimationEasing'] = [
    '#type' => 'select',
    '#title' => t('Animation easing'),
    '#description' => t("The easing function to use for animations."),
    '#options' => [
      'linear' => t('Linear'),
      'swing' => t('Swing'),
    ],
    '#default_value' => $default_values['masonry_animation_easing'],
    '#states' => [
      'visible' => [
        'input.form-checkbox[name*="isLayoutResizable"]' => [
          'checked' => TRUE,
        ],
        'input.form-checkbox[name*="isLayoutAnimated"]' => [
          'checked' => TRUE,
        ],
      ],
    ],
  ];
}