GridStackFormatterTrait.php in GridStack 8
Same filename and directory in other branches
File
src/Plugin/Field/FieldFormatter/GridStackFormatterTrait.phpView source
<?php
namespace Drupal\gridstack\Plugin\Field\FieldFormatter;
use Drupal\Core\Field\FieldDefinitionInterface;
/**
* A Trait common for gridstack formatters.
*/
trait GridStackFormatterTrait {
/**
* The gridstack field formatter manager.
*
* @var \Drupal\gridstack\GridStackFormatterInterface
*/
protected $formatter;
/**
* The gridstack field formatter manager.
*
* @var \Drupal\gridstack\GridStackManagerInterface
*/
protected $manager;
/**
* Returns the gridstack field formatter service.
*/
public function formatter() {
return $this->formatter;
}
/**
* Returns the gridstack service.
*/
public function manager() {
return $this->manager;
}
/**
* Returns the gridstack admin service shortcut.
*/
public function admin() {
return \Drupal::service('gridstack.admin');
}
/**
* {@inheritdoc}
*/
public function settingsSummary() {
// @todo: Remove second param post Blazy RC2+.
return $this
->admin()
->getSettingsSummary($this
->getScopedFormElements(), $this);
}
/**
* {@inheritdoc}
*/
public static function isApplicable(FieldDefinitionInterface $field_definition) {
return $field_definition
->getFieldStorageDefinition()
->isMultiple();
}
}
Traits
Name | Description |
---|---|
GridStackFormatterTrait | A Trait common for gridstack formatters. |