class SlickImageFormatter in Slick Carousel 7.3
Same name and namespace in other branches
- 8.2 src/Plugin/Field/FieldFormatter/SlickImageFormatter.php \Drupal\slick\Plugin\Field\FieldFormatter\SlickImageFormatter
- 8 src/Plugin/Field/FieldFormatter/SlickImageFormatter.php \Drupal\slick\Plugin\Field\FieldFormatter\SlickImageFormatter
Plugin implementation of the 'Slick Image' formatter.
Hierarchy
- class \Drupal\blazy\Plugin\Field\FieldFormatter\FormatterBase implements FormatterInterface
- class \Drupal\blazy\Plugin\Field\FieldFormatter\BlazyFormatterBase
- class \Drupal\slick\Plugin\Field\FieldFormatter\SlickFormatterBase
- class \Drupal\slick\Plugin\Field\FieldFormatter\SlickImageFormatter uses SlickFormatterTrait
- class \Drupal\slick\Plugin\Field\FieldFormatter\SlickFormatterBase
- class \Drupal\blazy\Plugin\Field\FieldFormatter\BlazyFormatterBase
Expanded class hierarchy of SlickImageFormatter
File
- src/
Plugin/ Field/ FieldFormatter/ SlickImageFormatter.php, line 8
Namespace
Drupal\slick\Plugin\Field\FieldFormatterView source
class SlickImageFormatter extends SlickFormatterBase {
use SlickFormatterTrait;
/**
* {@inheritdoc}
*/
protected function getCaption($item, $caption, $settings) {
return empty($item->{$caption}) ? [] : [
'#markup' => filter_xss_admin($item->{$caption}),
];
}
/**
* {@inheritdoc}
*/
public function buildElement(array &$element, $entity, $delta = 0) {
$settings = $element['settings'];
$item_id = $settings['item_id'];
// Image with responsive image, lazyLoad, and lightbox supports.
$element[$item_id] = $this
->formatter()
->getBlazy($element);
// Build caption if so configured, supports file entity/ media via $file.
if (!empty($settings['caption'])) {
foreach ($settings['caption'] as $caption) {
$element['caption'][$caption] = $this
->getCaption($entity, $caption, $element['settings']);
}
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
BlazyFormatterBase:: |
protected | function | Converts $items array to object for easy D8 -> D7 backports. | 1 |
BlazyFormatterBase:: |
public | function |
Returns required form elements for the current formatter. Overrides FormatterBase:: |
2 |
BlazyFormatterBase:: |
public | function |
Implements hook_field_formatter_settings_form(). Overrides FormatterBase:: |
1 |
BlazyFormatterTrait:: |
protected | property | The blazy-related formatter service. | |
BlazyFormatterTrait:: |
protected | property | The blazy field formatter manager. | |
BlazyFormatterTrait:: |
public | function | Returns the blazy-related formatter. | |
BlazyFormatterTrait:: |
public | function | Returns the blazy service. | |
BlazyFormatterTrait:: |
public | function | ||
FormatterBase:: |
protected | property | The blazy-related admin formatter service. | |
FormatterBase:: |
protected | property | Whether default settings have been merged into the current $settings. | |
FormatterBase:: |
protected | property | The field definition. | |
FormatterBase:: |
protected | property | The field display. | |
FormatterBase:: |
protected | property | The field instance. | |
FormatterBase:: |
protected | property | The form settings. | |
FormatterBase:: |
protected | property | True if the field cardinality equals -1. | |
FormatterBase:: |
protected | property | The known hard-coded entities. | |
FormatterBase:: |
protected | property | The langcode. | |
FormatterBase:: |
protected | property | The blazy formatter plugin id. | |
FormatterBase:: |
protected | property | The formatter settings. | |
FormatterBase:: |
protected | property | The view mode. | |
FormatterBase:: |
public | function | Builds the settings. | 1 |
FormatterBase:: |
public | function | Implements hook_field_formatter_settings_form(). | |
FormatterBase:: |
public | function | ||
FormatterBase:: |
public | function | Gets html settings. | |
FormatterBase:: |
public | function | Gets formatter plugin id. | |
FormatterBase:: |
public | function | ||
FormatterBase:: |
public | function | Gets formatter settings. | |
FormatterBase:: |
protected | function | Merges default settings values into $settings. | |
FormatterBase:: |
public | function | Sets html settings. | |
FormatterBase:: |
public | function | ||
FormatterBase:: |
public | function | Sets formatter settings. | |
FormatterBase:: |
protected | function | Setup common variables across different hooks. | |
FormatterBase:: |
public | function | Implements hook_field_formatter_view(). | |
SlickFormatterBase:: |
public | function | Build the slick carousel elements. | 1 |
SlickFormatterBase:: |
public static | function |
Returns default settings. Overrides BlazyFormatterBase:: |
1 |
SlickFormatterBase:: |
public | function |
Defines the scope for the form elements. Overrides BlazyFormatterBase:: |
1 |
SlickFormatterBase:: |
public | function |
Constructs a SlickImageFormatter instance. Overrides FormatterBase:: |
|
SlickFormatterTrait:: |
public | function | Returns the slick admin service. | |
SlickFormatterTrait:: |
public | function | 1 | |
SlickImageFormatter:: |
public | function |
Build individual item if so configured such as for file entity goodness. Overrides BlazyFormatterBase:: |
|
SlickImageFormatter:: |
protected | function |
Build caption element if so configured can be used for thumbnail caption. Overrides SlickFormatterBase:: |