You are here

public function RealisticDummyContentEntityBase::getBundle in Realistic Dummy Content 3.x

Same name and namespace in other branches
  1. 8.2 api/src/includes/RealisticDummyContentEntityBase.php \Drupal\realistic_dummy_content_api\includes\RealisticDummyContentEntityBase::getBundle()
  2. 7.2 api/src/includes/RealisticDummyContentEntityBase.php \Drupal\realistic_dummy_content_api\includes\RealisticDummyContentEntityBase::getBundle()

Get the bundle of the entity being manipulated.

All entities must have a type and a bundle. The type can be node, user, etc. and the bundle can be article, page. In case of a user, there must be a bundle even if there is only one: it is called user, like the entity type.

Return value

string The bundle, for example "article" or "user". Is a bundle is not readily available, return the entity type.

1 call to RealisticDummyContentEntityBase::getBundle()
RealisticDummyContentFieldModifier::getFields in api/src/includes/RealisticDummyContentFieldModifier.php
Get fields for the entity, for example body or field_image.

File

api/src/includes/RealisticDummyContentEntityBase.php, line 143

Class

RealisticDummyContentEntityBase
Generic entity manipulator.

Namespace

Drupal\realistic_dummy_content_api\includes

Code

public function getBundle() {
  $entity = $this
    ->getEntity();
  if (isset($entity->type)) {
    return Framework::instance()
      ->getBundleName($entity);
  }
  else {
    return $this
      ->getType();
  }
}