class BlazyAdminFormatter in Blazy 8
Same name and namespace in other branches
- 8.2 src/Form/BlazyAdminFormatter.php \Drupal\blazy\Form\BlazyAdminFormatter
- 7 src/Form/BlazyAdminFormatter.php \Drupal\blazy\Form\BlazyAdminFormatter
Provides admin form specific to Blazy admin formatter.
Hierarchy
- class \Drupal\blazy\Form\BlazyAdminBase implements BlazyAdminInterface uses StringTranslationTrait
- class \Drupal\blazy\Form\BlazyAdminFormatterBase
- class \Drupal\blazy\Form\BlazyAdminFormatter
- class \Drupal\blazy\Form\BlazyAdminFormatterBase
Expanded class hierarchy of BlazyAdminFormatter
1 file declares its use of BlazyAdminFormatter
- BlazyAdminFormatterUnitTest.php in tests/
src/ Unit/ Form/ BlazyAdminFormatterUnitTest.php
1 string reference to 'BlazyAdminFormatter'
1 service uses BlazyAdminFormatter
File
- src/
Form/ BlazyAdminFormatter.php, line 10
Namespace
Drupal\blazy\FormView 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;
$this
->openingForm($form, $definition);
$this
->imageStyleForm($form, $definition);
if (!empty($definition['media_switch_form']) && !isset($form['media_switch'])) {
$this
->mediaSwitchForm($form, $definition);
}
if (!empty($definition['grid_form']) && !isset($form['grid'])) {
$this
->gridForm($form, $definition);
// Blazy doesn't need complex grid with multiple groups.
unset($form['preserve_keys'], $form['visible_items']);
if (isset($form['grid'])) {
$form['grid']['#description'] = $this
->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
->breakpointsForm($form, $definition);
}
if (isset($form['responsive_image_style'])) {
$form['responsive_image_style']['#description'] = $this
->t('Not compatible with below breakpoints, aspect ratio, yet. However it can still lazyload by checking <strong>Responsive image</strong> option via Blazy UI. Leave empty to disable.');
if ($this
->blazyManager()
->getModuleHandler()
->moduleExists('blazy_ui')) {
$form['responsive_image_style']['#description'] .= ' ' . $this
->t('<a href=":url" target="_blank">Enable lazyloading Responsive image</a>.', [
':url' => Url::fromRoute('blazy.settings')
->toString(),
]);
}
}
$this
->closingForm($form, $definition);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
BlazyAdminBase:: |
protected | property | The blazy manager service. | |
BlazyAdminBase:: |
protected | property | The entity type manager service. | |
BlazyAdminBase:: |
protected | property | The typed config manager service. | |
BlazyAdminBase:: |
public | function | Returns simple form elements common for Views field, EB widget, formatters. | |
BlazyAdminBase:: |
public | function | Returns the blazy manager. | |
BlazyAdminBase:: |
public | function | Defines re-usable breakpoints form. | |
BlazyAdminBase:: |
public | function | Defines re-usable breakpoints form. | |
BlazyAdminBase:: |
public | function | Returns shared ending form elements across field formatter and Views. | 1 |
BlazyAdminBase:: |
public static | function | ||
BlazyAdminBase:: |
public | function | Returns re-usable logic, styling and assets across fields and Views. | |
BlazyAdminBase:: |
public | function | Returns time in interval for select options. | |
BlazyAdminBase:: |
public | function | Returns the entity display repository. | |
BlazyAdminBase:: |
public | function | Returns available optionsets for select options. | |
BlazyAdminBase:: |
protected | function | Get one of the pre-defined states used in this form. | |
BlazyAdminBase:: |
public | function | Returns the typed config. | |
BlazyAdminBase:: |
public | function | Returns available view modes for select options. | |
BlazyAdminBase:: |
public | function | Returns re-usable grid elements across field formatter and Views. | |
BlazyAdminBase:: |
public | function | Returns re-usable media switch form elements. | |
BlazyAdminBase:: |
public | function | Returns shared form elements across field formatter and Views. | 1 |
BlazyAdminBase:: |
constant | A state that represents the media switch iframe is enabled. | ||
BlazyAdminBase:: |
constant | A state that represents the image rendered switch is enabled. | ||
BlazyAdminBase:: |
constant | A state that represents the custom lightbox caption is enabled. | ||
BlazyAdminBase:: |
constant | A state that represents the media switch lightbox is enabled. | ||
BlazyAdminBase:: |
constant | A state that represents the responsive image style is disabled. | ||
BlazyAdminBase:: |
constant | A state that represents the thumbnail style is enabled. | ||
BlazyAdminBase:: |
public | function | Constructs a BlazyAdminBase object. | |
BlazyAdminFormatter:: |
public | function | Defines re-usable form elements. | |
BlazyAdminFormatterBase:: |
public | function | Declutters options from less relevant options. | |
BlazyAdminFormatterBase:: |
public | function | Exclude the field formatter settings summary as required. | |
BlazyAdminFormatterBase:: |
public | function | Returns available fields for select options. | |
BlazyAdminFormatterBase:: |
public | function | Returns Responsive image for select options. | |
BlazyAdminFormatterBase:: |
public | function | Return the field formatter settings summary. | |
BlazyAdminFormatterBase:: |
public | function | Returns re-usable image formatter form elements. | |
BlazyAdminFormatterBase:: |
public | function | Return the field formatter settings summary. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |