You are here

trait GridStackFormatterTrait in GridStack 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/FieldFormatter/GridStackFormatterTrait.php \Drupal\gridstack\Plugin\Field\FieldFormatter\GridStackFormatterTrait

A Trait common for gridstack formatters.

Hierarchy

File

src/Plugin/Field/FieldFormatter/GridStackFormatterTrait.php, line 10

Namespace

Drupal\gridstack\Plugin\Field\FieldFormatter
View source
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();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
GridStackFormatterTrait::$formatter protected property The gridstack field formatter manager.
GridStackFormatterTrait::$manager protected property The gridstack field formatter manager.
GridStackFormatterTrait::admin public function Returns the gridstack admin service shortcut.
GridStackFormatterTrait::formatter public function Returns the gridstack field formatter service.
GridStackFormatterTrait::isApplicable public static function 3
GridStackFormatterTrait::manager public function Returns the gridstack service.
GridStackFormatterTrait::settingsSummary public function