checkFieldStorageDefinitionTranslatability example

/** * Checks whether the entity type supports author natively. * * @return bool * TRUE if metadata is natively supported, FALSE otherwise. */
  protected function hasAuthor() {
    // Check for field named uid, but only in case the entity implements the     // EntityOwnerInterface. This helps to exclude cases, where the uid is     // defined as field name, but is not meant to be an owner field; for     // instance, the User entity.     return $this->entityType->entityClassImplements(EntityOwnerInterface::class) && $this->checkFieldStorageDefinitionTranslatability('uid');
  }

  /** * Checks whether the entity type supports published status natively. * * @return bool * TRUE if metadata is natively supported, FALSE otherwise. */
  protected function hasPublishedStatus() {
    return $this->checkFieldStorageDefinitionTranslatability('status');
  }

  
Home | Imprint | This part of the site doesn't use cookies.