gridstack-8.x-2.5/src/GridStackDefault.php

src/GridStackDefault.php
<?php

namespace Drupal\gridstack;

use Drupal\blazy\BlazyDefault;

/**
 * Defines shared plugin default settings for field formatter and Views style.
 *
 * @see FormatterBase::defaultSettings()
 * @see StylePluginBase::defineOptions()
 */
class GridStackDefault extends BlazyDefault {

  /**
   * Returns common settings across plugins.
   */
  public static function commonSettings() {
    return [
      'gridnative' => FALSE,
      'skin'       => '',
    ];
  }

  /**
   * {@inheritdoc}
   */
  public static function baseSettings() {
    return [
      'optionset' => 'default',
      'vanilla'   => FALSE,
    ] + self::commonSettings() + parent::baseSettings();
  }

  /**
   * {@inheritdoc}
   */
  public static function imageSettings() {
    $settings = parent::imageSettings() + self::baseSettings();

    foreach (['breakpoints', 'responsive_image_style', 'sizes'] as $key) {
      unset($settings[$key]);
    }

    return [
      'background'  => TRUE,
      'category'    => '',
      'stamp'       => '',
      'stamp_index' => 0,
    ] + $settings;
  }

  /**
   * {@inheritdoc}
   */
  public static function extendedSettings() {
    return self::imageSettings() + parent::extendedSettings();
  }

  /**
   * Returns view fields options for Views UI.
   */
  public static function viewFieldOptions() {
    return [
      'captions',
      'layouts',
      'images',
      'links',
      'titles',
      'classes',
      'overlays',
    ];
  }

  /**
   * Returns fixed settings not configurable via UI.
   */
  public static function fixedSettings() {
    return [
      'item_id'   => 'box',
      'nameshort' => 'gs',
      'namespace' => 'gridstack',
      'ratio'     => '',
      'blazy'     => TRUE,
      'lazy'      => 'blazy',
    ];
  }

  /**
   * Returns shared global form settings which should be consumed at formatters.
   */
  public static function uiSettings() {
    return [
      'debug'      => FALSE,
      'dev'        => FALSE,
      'excludes'   => '',
      'framework'  => '',
      'fw_classes' => '',
      'library'    => '',
      'optimized'  => FALSE,
    ];
  }

  /**
   * Returns Panels/ Layout Builder settings.
   */
  public static function regionSettings() {
    return [
      'attributes'      => '',
      'wrapper'         => 'div',
      'wrapper_classes' => '',
    ];
  }

  /**
   * Returns Panels/ Layout Builder settings.
   */
  public static function layoutSettings() {
    return [
      'extras' => '',
      'vm'     => '',
    ] + self::commonSettings() + self::regionSettings();
  }

  /**
   * Returns wrapper Panels/ Layout Builder select options.
   */
  public static function wrapperOptions() {
    return [
      'div'     => 'Div',
      'article' => 'Article',
      'aside'   => 'Aside',
      'figure'  => 'Figure',
      'header'  => 'Header',
      'main'    => 'Main',
      'footer'  => 'Footer',
      'section' => 'Section',
    ];
  }

  /**
   * Returns HTML or layout related settings, none of JS to shutup notices.
   */
  public static function htmlSettings() {
    return [
      '_admin'        => FALSE,
      '_access_ipe'   => FALSE,
      '_layouts'      => FALSE,
      '_panels'       => FALSE,
      'column'        => 12,
      'debug'         => FALSE,
      'ungridstack'   => FALSE,
      'id'            => '',
      'lightbox'      => '',
      'nested'        => FALSE,
      'root'          => TRUE,
      'use_framework' => FALSE,
      'use_js'        => FALSE,
      'use_inner'     => TRUE,
      'view_name'     => '',
    ] + self::commonSettings() + self::imageSettings() + self::fixedSettings();
  }

  /**
   * Returns breakpoints.
   */
  public static function breakpoints() {
    return [
      'xs' => 'xsmall',
      'sm' => 'small',
      'md' => 'medium',
      'lg' => 'large',
      'xl' => 'xlarge',
    ];
  }

  /**
   * Returns region ID.
   */
  public static function regionId($id) {
    return 'gridstack_' . $id;
  }

  /**
   * Returns theme properties.
   */
  public static function themeProperties() {
    return [
      'items',
      'optionset',
      'postscript',
      'settings',
    ];
  }

}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc