You are here

public function DsFieldBase::getEntityTypeId in Display Suite 8.2

Same name and namespace in other branches
  1. 8.4 src/Plugin/DsField/DsFieldBase.php \Drupal\ds\Plugin\DsField\DsFieldBase::getEntityTypeId()
  2. 8.3 src/Plugin/DsField/DsFieldBase.php \Drupal\ds\Plugin\DsField\DsFieldBase::getEntityTypeId()

Gets the current entity type.

Overrides DsFieldInterface::getEntityTypeId

3 calls to DsFieldBase::getEntityTypeId()
Field::build in src/Plugin/DsField/Field.php
Renders a field.
SwitchField::settingsForm in modules/ds_extras/src/Plugin/DsField/SwitchField.php
The form that holds the settings for this plugin.
SwitchField::settingsSummary in modules/ds_extras/src/Plugin/DsField/SwitchField.php
Returns the summary of the chosen settings.

File

src/Plugin/DsField/DsFieldBase.php, line 118

Class

DsFieldBase
Base class for all the ds plugins.

Namespace

Drupal\ds\Plugin\DsField

Code

public function getEntityTypeId() {
  if (isset($this->configuration['entity_type'])) {
    return $this->configuration['entity_type'];
  }
  elseif ($entity = $this
    ->entity()) {

    /* @var $entity EntityInterface */
    return $entity
      ->getEntityTypeId();
  }
  else {
    return '';
  }
}