PHP code example of b13 / listelements

1. Go to this page and download the library: Download b13/listelements 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/ */

    

b13 / listelements example snippets




namespace B13\SiteExtension\Hooks;

use TYPO3\CMS\Backend\View\PageLayoutViewDrawItemHookInterface;
use TYPO3\CMS\Backend\View\PageLayoutView;

/**
 * Class/Function to manipulate the rendering of item preview content
 *
 */
class DrawItem implements PageLayoutViewDrawItemHookInterface
{

    /**
     * @param PageLayoutView $parentObject : The parent object that triggered this hook
     * @param boolean $drawItem : A switch to tell the parent object, if the item still must be drawn
     * @param string $headerContent : The content of the item header
     * @param string $itemContent : The content of the item itself
     * @param array $row : The current data row for this item
     *
     * @return void
     */
    public function preProcess(PageLayoutView &$parentObject, &$drawItem, &$headerContent, &$itemContent, array &$row)
    {

        // get all list items (database column 'test_list') including all assets
        if ($row['test_list']) {
            // array &$row, $field = '', $table = 'tt_content', $filereferences = 'assets, additional_assets'
            \B13\Listelements\Service\ListService::resolveListitems($row, 'test_list', 'tt_content');
        }

    }

}