/** * @param ContentInterface $content * @param string $fieldId * * @return ContentAttributeInterface */ protected function getContentAttribute(ContentInterface $content, $fieldId) { $contentAttribute = $content->getAttributeByName($fieldId); if (!$contentAttribute instanceof ContentAttributeInterface) { $contentAttributeClass = $this->contentAttributeClass; /** @var ContentAttributeInterface $contentAttribute */ $contentAttribute = new $contentAttributeClass(); $contentAttribute->setName($fieldId); $content->addAttribute($contentAttribute); } return $contentAttribute; }