You are here

protected function Masonry::defineOptions in Masonry Views 8

Information about options for all kinds of purposes will be held here.


'option_name' => array(
 - 'default' => default value,
 - 'contains' => (optional) array of items this contains, with its own
     defaults, etc. If contains is set, the default will be ignored and
     assumed to be array().
 ),

Return value

array Returns the options of this handler/plugin.

Overrides StylePluginBase::defineOptions

File

src/Plugin/views/style/Masonry.php, line 54
Contains \Drupal\masonry_views\Plugin\views\style\Masonry.

Class

Masonry
Style plugin to render each item in a Masonry Layout.

Namespace

Drupal\masonry_views\Plugin\views\style

Code

protected function defineOptions() {
  $options = parent::defineOptions();

  // Get default options from Masonry.
  $default_options = \Drupal::service('masonry.service')
    ->getMasonryDefaultOptions();

  // Set default values for Masonry.
  foreach ($default_options as $option => $default_value) {
    $options[$option] = [
      'default' => $default_value,
    ];
    if (is_int($default_value)) {
      $options[$option]['bool'] = TRUE;
    }
  }
  return $options;
}