- Issue created by @2dareis2do
- 🇬🇧United Kingdom 2dareis2do
/** * Get default Masonry options. * * @return array * An associative array of default options for Masonry. * Contains: * - layoutColumnWidth: The width of each column (in pixels, percentage or as * a CSS selector). * - gutterWidth: The spacing between each column (in pixels, percentage or as * a CSS selector). * - isLayoutResizable: Automatically rearrange items when the container is * resized. * - isLayoutAnimated: Animate item rearrangements. * - layoutAnimationDuration: The duration of animations (in milliseconds). * - isLayoutFitsWidth: Sets the width of the container to the nearest * column. Ideal for centering Masonry layouts. * - isLayoutRtlMode: Display items from right-to-left. * - isLayoutImagesLoadedFirst: Load all images first before triggering * Masonry. * - isLayoutImagesLazyLoaded: Custom observer to support layout rebuild in * lazysizes images lazy loading. * - imageLazyloadSelector: lazyLoad class selector used by lazysizes. * - imageLazyloadedSelector: lazyLoaded class selector used by lazysizes. * - stampSelector: Specifies which elements are stamped within the layout * using css selector. * - isItemsWidthForce: Forces the items width to column width. * - isItemsPositionInPercent: Sets item positions in percent values, rather * than pixel values. */ public function getMasonryDefaultOptions() { $options = [ 'layoutColumnWidth' => '', 'gutterWidth' => '0', 'isLayoutResizable' => TRUE, 'isLayoutAnimated' => TRUE, 'layoutAnimationDuration' => 500, 'isLayoutFitsWidth' => FALSE, 'isLayoutRtlMode' => ($this->languageManager->getCurrentLanguage()->getDirection() == LanguageInterface::DIRECTION_RTL), 'isLayoutImagesLoadedFirst' => TRUE, 'isLayoutImagesLazyLoaded' => FALSE, 'imageLazyloadSelector' => 'lazyload', 'imageLazyloadedSelector' => 'lazyloaded', 'stampSelector' => '', 'isItemsWidthForce' => TRUE, 'isItemsPositionInPercent' => FALSE, 'extraOptions' => [], ]; // Loazyloading classes are auto-calculated for user simplicity. When // lazysizes is used without a Drupal module, this means DX is able to use // hook_masonry_default_options_alter or hook_masonry_options_form_alter to // override this setting. if ($this->moduleHandler->moduleExists('lazy')) { $config = $this->configFactory->get('lazy.settings'); $options['imageLazyloadSelector'] = $config->get('lazysizes.lazyClass'); $options['imageLazyloadedSelector'] = $config->get('lazysizes.loadedClass'); } return $options; }