PHP code example of elbformat / field-helper-bundle

1. Go to this page and download the library: Download elbformat/field-helper-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

elbformat / field-helper-bundle example snippets


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();
}