function ContentEntityBase::hasField

Same name in other branches
  1. 9 core/lib/Drupal/Core/Entity/ContentEntityBase.php \Drupal\Core\Entity\ContentEntityBase::hasField()
  2. 10 core/lib/Drupal/Core/Entity/ContentEntityBase.php \Drupal\Core\Entity\ContentEntityBase::hasField()
  3. 11.x core/lib/Drupal/Core/Entity/ContentEntityBase.php \Drupal\Core\Entity\ContentEntityBase::hasField()
5 calls to ContentEntityBase::hasField()
ContentEntityBase::isRevisionTranslationAffected in core/lib/Drupal/Core/Entity/ContentEntityBase.php
ContentEntityBase::setDefaultLangcode in core/lib/Drupal/Core/Entity/ContentEntityBase.php
Populates the local cache for the default language code.
ContentEntityBase::setRevisionTranslationAffected in core/lib/Drupal/Core/Entity/ContentEntityBase.php
ContentEntityBase::__isset in core/lib/Drupal/Core/Entity/ContentEntityBase.php
Implements the magic method for isset().
ContentEntityBase::__unset in core/lib/Drupal/Core/Entity/ContentEntityBase.php
Implements the magic method for unset().

File

core/lib/Drupal/Core/Entity/ContentEntityBase.php, line 559

Class

ContentEntityBase
Implements Entity Field API specific enhancements to the Entity class.

Namespace

Drupal\Core\Entity

Code

public function hasField($field_name) {
    return (bool) $this->getFieldDefinition($field_name);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.