You are here

class BlazyAdminFormatter in Blazy 7

Same name and namespace in other branches
  1. 8.2 src/Form/BlazyAdminFormatter.php \Drupal\blazy\Form\BlazyAdminFormatter
  2. 8 src/Form/BlazyAdminFormatter.php \Drupal\blazy\Form\BlazyAdminFormatter

Provides admin form specific to Blazy admin formatter.

Hierarchy

Expanded class hierarchy of BlazyAdminFormatter

2 files declare their use of BlazyAdminFormatter
BlazyFormatterBlazy.php in src/Plugin/Field/FieldFormatter/BlazyFormatterBlazy.php
BlazyTextFormatter.php in src/Plugin/Field/FieldFormatter/BlazyTextFormatter.php

File

src/Form/BlazyAdminFormatter.php, line 8

Namespace

Drupal\blazy\Form
View source
class BlazyAdminFormatter extends BlazyAdminFormatterBase {

  /**
   * Defines re-usable form elements.
   */
  public function buildSettingsForm(array &$form, $definition = []) {
    $definition['namespace'] = 'blazy';
    $definition['responsive_image'] = isset($definition['responsive_image']) ? $definition['responsive_image'] : TRUE;
    $forms = isset($definition['forms']) ? $definition['forms'] : [];
    $this
      ->openingForm($form, $definition);

    // This allows Blazy to display texts as a grid, without images.
    if (!empty($forms['image_style']) && !isset($form['image_style'])) {
      $this
        ->imageStyleForm($form, $definition);
    }
    if (!empty($forms['media_switch']) && !isset($form['media_switch'])) {
      $this
        ->mediaSwitchForm($form, $definition);
    }
    if (!empty($forms['grid']) && !isset($form['grid'])) {
      $this
        ->gridForm($form, $definition);

      // Blazy doesn't need complex grid with multiple groups.
      unset($form['preserve_keys'], $form['visible_items']);
      $form['grid']['#description'] = t('The amount of block grid columns for large monitors 64.063em+. <br /><strong>Requires</strong>:<ol><li>Display style.</li><li>A reasonable amount of contents.</li></ol>Leave empty to DIY, or to not build grids.');
    }
    if (!empty($definition['breakpoints']) && !$this
      ->manager()
      ->config('unbreakpoints', FALSE, 'blazy.settings')) {
      $this
        ->breakpointsForm($form, $definition);
    }
    $this
      ->closingForm($form, $definition);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
BlazyAdminBase::$manager protected property The blazy manager service.
BlazyAdminBase::$viewModeOptions protected property The available view modes.
BlazyAdminBase::baseForm public function Returns simple form elements common for Views field, EB widget, formatters.
BlazyAdminBase::breakpointElements public function Defines re-usable breakpoints form.
BlazyAdminBase::breakpointsForm public function Defines re-usable breakpoints form.
BlazyAdminBase::closingForm public function Returns shared ending form elements across field formatter and Views. 1
BlazyAdminBase::finalizeForm public function Returns re-usable logic, styling and assets across fields and Views.
BlazyAdminBase::getBundlePath protected function Helper function for getting correct bundle for manage field/display path.
BlazyAdminBase::getCacheOptions public function Returns time in interval for select options.
BlazyAdminBase::getOptionsetOptions public function Returns available optionsets for select options.
BlazyAdminBase::getState protected function Get one of the pre-defined states used in this form.
BlazyAdminBase::getViewModeOptions public function Returns available view modes for select options.
BlazyAdminBase::gridForm public function Returns re-usable grid elements across field formatter and Views.
BlazyAdminBase::manager public function Returns the blazy manager.
BlazyAdminBase::mediaSwitchForm public function Returns re-usable media switch form elements.
BlazyAdminBase::openingForm public function Returns shared form elements across field formatter and Views. 1
BlazyAdminBase::showAltTitleFieldHint protected function If the image field doesn't have the Title field enabled, tell the user.
BlazyAdminBase::STATE_IFRAME_ENABLED constant A state that represents the media switch iframe is enabled.
BlazyAdminBase::STATE_IMAGE_RENDERED_ENABLED constant A state that represents the image rendered switch is enabled.
BlazyAdminBase::STATE_LIGHTBOX_CUSTOM constant A state that represents the custom lightbox caption is enabled.
BlazyAdminBase::STATE_LIGHTBOX_ENABLED constant A state that represents the media switch lightbox is enabled.
BlazyAdminBase::STATE_RESPONSIVE_IMAGE_STYLE_DISABLED constant A state that represents the responsive image style is disabled.
BlazyAdminBase::STATE_THUMBNAIL_STYLE_ENABLED constant A state that represents the thumbnail style is enabled.
BlazyAdminBase::__construct public function Constructs a BlazyAdmin instance.
BlazyAdminFormatter::buildSettingsForm public function Defines re-usable form elements.
BlazyAdminFormatterBase::getBundles private function Returns the expected bundles.
BlazyAdminFormatterBase::getExcludedFieldOptions public function Declutters options from less relevant options.
BlazyAdminFormatterBase::getExcludedSettingsSummary public function Exclude the field formatter settings summary as required.
BlazyAdminFormatterBase::getFieldOptions public function Returns available fields for select options.
BlazyAdminFormatterBase::getFieldOptionsInternal private function Helper function to get list of supported field base on field_types.
BlazyAdminFormatterBase::getResponsiveImageOptions public function Returns Picture for select options.
BlazyAdminFormatterBase::getSettingsSummary public function Return the field formatter settings summary.
BlazyAdminFormatterBase::imageStyleForm public function Returns re-usable image formatter form elements.