Mercurial > hg > isophonics-drupal-site
comparison core/lib/Drupal/Core/Entity/Entity.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | c2387f117808 |
children | af1871eacc83 |
comparison
equal
deleted
inserted
replaced
16:c2387f117808 | 17:129ea1e6d783 |
---|---|
3 namespace Drupal\Core\Entity; | 3 namespace Drupal\Core\Entity; |
4 | 4 |
5 use Drupal\Core\Cache\Cache; | 5 use Drupal\Core\Cache\Cache; |
6 use Drupal\Core\Cache\RefinableCacheableDependencyTrait; | 6 use Drupal\Core\Cache\RefinableCacheableDependencyTrait; |
7 use Drupal\Core\DependencyInjection\DependencySerializationTrait; | 7 use Drupal\Core\DependencyInjection\DependencySerializationTrait; |
8 use Drupal\Component\Utility\Unicode; | |
9 use Drupal\Core\Config\Entity\Exception\ConfigEntityIdLengthException; | 8 use Drupal\Core\Config\Entity\Exception\ConfigEntityIdLengthException; |
10 use Drupal\Core\Entity\Exception\UndefinedLinkTemplateException; | 9 use Drupal\Core\Entity\Exception\UndefinedLinkTemplateException; |
11 use Drupal\Core\Language\Language; | 10 use Drupal\Core\Language\Language; |
12 use Drupal\Core\Language\LanguageInterface; | 11 use Drupal\Core\Language\LanguageInterface; |
13 use Drupal\Core\Link; | 12 use Drupal\Core\Link; |
429 */ | 428 */ |
430 public function preSave(EntityStorageInterface $storage) { | 429 public function preSave(EntityStorageInterface $storage) { |
431 // Check if this is an entity bundle. | 430 // Check if this is an entity bundle. |
432 if ($this->getEntityType()->getBundleOf()) { | 431 if ($this->getEntityType()->getBundleOf()) { |
433 // Throw an exception if the bundle ID is longer than 32 characters. | 432 // Throw an exception if the bundle ID is longer than 32 characters. |
434 if (Unicode::strlen($this->id()) > EntityTypeInterface::BUNDLE_MAX_LENGTH) { | 433 if (mb_strlen($this->id()) > EntityTypeInterface::BUNDLE_MAX_LENGTH) { |
435 throw new ConfigEntityIdLengthException("Attempt to create a bundle with an ID longer than " . EntityTypeInterface::BUNDLE_MAX_LENGTH . " characters: $this->id()."); | 434 throw new ConfigEntityIdLengthException("Attempt to create a bundle with an ID longer than " . EntityTypeInterface::BUNDLE_MAX_LENGTH . " characters: $this->id()."); |
436 } | 435 } |
437 } | 436 } |
438 } | 437 } |
439 | 438 |