abstract class SlickEntityFormatterBase in Slick Carousel 8.2
Same name and namespace in other branches
- 8 src/Plugin/Field/FieldFormatter/SlickEntityFormatterBase.php \Drupal\slick\Plugin\Field\FieldFormatter\SlickEntityFormatterBase
- 7.3 src/Plugin/Field/FieldFormatter/SlickEntityFormatterBase.php \Drupal\slick\Plugin\Field\FieldFormatter\SlickEntityFormatterBase
Base class for slick entity reference formatters without field details.
Hierarchy
- class \Drupal\slick\Plugin\Field\FieldFormatter\SlickEntityFormatterBase extends \Drupal\blazy\Dejavu\BlazyEntityBase implements ContainerFactoryPluginInterface uses SlickFormatterTrait, SlickFormatterViewTrait
Expanded class hierarchy of SlickEntityFormatterBase
See also
\Drupal\slick_paragraphs\Plugin\Field\FieldFormatter
\Drupal\slick_entityreference\Plugin\Field\FieldFormatter
File
- src/
Plugin/ Field/ FieldFormatter/ SlickEntityFormatterBase.php, line 17
Namespace
Drupal\slick\Plugin\Field\FieldFormatterView source
abstract class SlickEntityFormatterBase extends BlazyEntityBase implements ContainerFactoryPluginInterface {
use SlickFormatterViewTrait;
use SlickFormatterTrait {
buildSettings as traitBuildSettings;
}
/**
* The logger factory.
*
* @var \Drupal\Core\Logger\LoggerChannelFactoryInterface
*/
protected $loggerFactory;
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
$instance = parent::create($container, $configuration, $plugin_id, $plugin_definition);
return self::injectServices($instance, $container, 'entity');
}
/**
* Returns the blazy manager.
*/
public function blazyManager() {
return $this->formatter;
}
/**
* {@inheritdoc}
*/
public static function defaultSettings() {
return [
'view_mode' => '',
] + SlickDefault::baseSettings();
}
/**
* {@inheritdoc}
*/
public function viewElements(FieldItemListInterface $items, $langcode) {
$entities = $this
->getEntitiesToView($items, $langcode);
// Early opt-out if the field is empty.
if (empty($entities)) {
return [];
}
return $this
->commonViewElements($items, $langcode, $entities);
}
/**
* Builds the settings.
*
* @todo inherit and extend parent post Blazy 2.x release.
*/
public function buildSettings() {
return [
'blazy' => TRUE,
'vanilla' => TRUE,
] + $this
->traitBuildSettings();
}
/**
* {@inheritdoc}
*/
public function getScopedFormElements() {
return [
'no_layouts' => TRUE,
] + $this
->getCommonScopedFormElements() + parent::getScopedFormElements();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
SlickEntityFormatterBase:: |
protected | property | The logger factory. | |
SlickEntityFormatterBase:: |
public | function | Returns the blazy manager. | |
SlickEntityFormatterBase:: |
public | function | Builds the settings. | |
SlickEntityFormatterBase:: |
public static | function |
Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface:: |
|
SlickEntityFormatterBase:: |
public static | function | ||
SlickEntityFormatterBase:: |
public | function | ||
SlickEntityFormatterBase:: |
public | function | ||
SlickFormatterTrait:: |
protected | property | The image factory service. | |
SlickFormatterTrait:: |
protected | property | The slick field formatter manager. | |
SlickFormatterTrait:: |
public | function | Returns the slick admin service shortcut. | |
SlickFormatterTrait:: |
public | function | Builds the settings. Aliased as: traitBuildSettings | 1 |
SlickFormatterTrait:: |
public | function | Returns the slick field formatter service. | |
SlickFormatterTrait:: |
public | function | Defines the common scope for both front and admin. | |
SlickFormatterTrait:: |
public | function | Defines the common scope for the form elements. | |
SlickFormatterTrait:: |
public | function | Returns the image factory. | |
SlickFormatterTrait:: |
protected static | function | Injects DI services. | |
SlickFormatterTrait:: |
public static | function | 2 | |
SlickFormatterTrait:: |
public | function | Returns the slick service. | |
SlickFormatterTrait:: |
public | function | ||
SlickFormatterViewTrait:: |
public | function | Returns similar view elements. |