public function FormatterBase::__construct in Blazy 7
Constructs a base formatter object.
2 calls to FormatterBase::__construct()
- BlazyFormatterBlazy::__construct in src/
Plugin/ Field/ FieldFormatter/ BlazyFormatterBlazy.php - Constructs a BlazyFormatter instance.
- BlazyTextFormatter::__construct in src/
Plugin/ Field/ FieldFormatter/ BlazyTextFormatter.php - Constructs a BlazyTextFormatter instance.
2 methods override FormatterBase::__construct()
- BlazyFormatterBlazy::__construct in src/
Plugin/ Field/ FieldFormatter/ BlazyFormatterBlazy.php - Constructs a BlazyFormatter instance.
- BlazyTextFormatter::__construct in src/
Plugin/ Field/ FieldFormatter/ BlazyTextFormatter.php - Constructs a BlazyTextFormatter instance.
File
- src/
Plugin/ Field/ FieldFormatter/ FormatterBase.php, line 97
Class
- FormatterBase
- Base class for blazy/slick image, and file formatters.
Namespace
Drupal\blazy\Plugin\Field\FieldFormatterCode
public function __construct($plugin_id, $field, $instance) {
$this->pluginId = $plugin_id;
$this->fieldDefinition = $field;
$this->fieldInstance = $instance;
$this->isMultiple = $field['cardinality'] == -1;
$this->bundle = $instance['bundle'];
$this->fieldName = $instance['field_name'];
$this->entityType = $instance['entity_type'];
$this->fieldType = $field['type'];
// For more entities, it is overriden via blazy_entity_load().
// Below is just for few known entities to save plugins from overriding.
$this->targetType = in_array($field['type'], $this->knownEntities) ? $field['type'] . '_item' : $field['type'];
}