You are here

function views_plugin_style_masonry_views::options_form in Masonry Views 7

Same name and namespace in other branches
  1. 7.3 views_plugin_style_masonry_views.inc \views_plugin_style_masonry_views::options_form()

Render the given style.

Overrides views_plugin_style::options_form

File

./views_plugin_style_masonry_views.inc, line 34
Contains the Masonry style plugin.

Class

views_plugin_style_masonry_views
@file Contains the Masonry style plugin.

Code

function options_form(&$form, &$form_state) {
  parent::options_form($form, $form_state);

  // Add Masonry options to views form
  $form['masonry'] = array(
    '#type' => 'fieldset',
    '#title' => t('Masonry'),
  );
  if (masonry_installed()) {
    masonry_add_options_to_form($form, $this->options);

    // Display each option within the Masonry fieldset
    foreach (masonry_default_options() as $option => $default_value) {
      $form[$option]['#fieldset'] = 'masonry';
    }

    // Views doesn't use FAPI states, so set dependencies instead
    $form['masonry_animated']['#dependency'] = array(
      'edit-style-options-masonry-resizable' => array(
        1,
      ),
    );
    $form['masonry_animation_duration']['#dependency'] = array(
      'edit-style-options-masonry-animated' => array(
        1,
      ),
    );
  }
  else {

    // Disable Masonry as plugin is not installed
    $form['masonry_disabled'] = array(
      '#markup' => t('These options have been disabled as the jQuery Masonry plugin is not installed.'),
      '#fieldset' => 'masonry',
    );
  }
}