/** * {@inheritdoc} */ public function jsonSerialize($format = self::JSON_DEFAULT_FORMAT) { $data = parent::jsonSerialize($format); if (isset($data['elements'])) { $elements = []; foreach ($data['elements'] as $element) { $elements[] = ['uid' => $element['uid'], 'type' => $element['type']]; } $data['elements'] = $elements; } return $data; }
/** * Computes classcontent identifier attribute and set it to attributes property array */ private function computeIdentifierAttribute() { $data = $this->content->jsonSerialize(); $this->attributes['data-bb-identifier'] = str_replace('\\', '/', $data['type']) . '(' . $data['uid'] . ')'; }