public function HashCdfAttribute::onPopulateAttributes in Acquia Content Hub 8.2
On populate attributes.
Parameters
\Drupal\acquia_contenthub\Event\CdfAttributesEvent $event: CDF attributes event.
Throws
\Exception
File
- src/
EventSubscriber/ CdfAttributes/ HashCdfAttribute.php, line 36
Class
- HashCdfAttribute
- Calculates a hash value of the entity and stores it as an attribute.
Namespace
Drupal\acquia_contenthub\EventSubscriber\CdfAttributesCode
public function onPopulateAttributes(CdfAttributesEvent $event) {
$cdf = $event
->getCdf();
$wrapper = $event
->getWrapper();
$cdf
->addAttribute('hash', CDFAttribute::TYPE_STRING, $wrapper
->getHash());
}