elbformat/field-helper-bundle

Provides helpers to extract and set structured data from and to ibexa content fields

Installs: 2 510

Dependents: 1

Suggesters: 0

Security: 0

Stars: 8

Watchers: 4

Forks: 1

Open Issues: 14

Type:symfony-bundle


README

CircleCI codecov License Badge

Elbformat Field Helper Bundle for ibexa DXP

This bundle provides helpers to extract and set structured data from and to ibexa content fields.

What are "Field helpers"?

Field helpers are intended to easily and safely access fields from content objects in a typed manner. With this you can make your project safe for static code analysis without adding too much boilerplate code everywhere. Especially for importer scripts, that create content, there is an update method which helps you to track changes. With thism, you can speed up the update process by not publishing it, when no change was made at all.

Quick usage

Install bundle via composer

$ composer require elbformat/field-helper-bundle

Use like this

public function getFields(RegistryInterface $fieldHelperRegistry, Content $content) {
    $myText = $fieldHelperRegistry->getTextFieldHelper()->getString($content, 'text_field');
    $linkObject = $fieldHelperRegistry->getLinkFieldHelper()->getLink($content, 'my_url');
    $linkUrl = $linkObj->getUrl();
    $linkText = $linkObj->getText();
}

Further topics