PHP code example of zeroseven / z7-blog

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

    

zeroseven / z7-blog example snippets


 declare(strict_types=1);

namespace Vendor\YourExtension\Domain\Traits;

trait PostModel
{

    protected $lol = true;

    public function getLol(): bool
    {
        return $this->lol;
    }

}

 declare(strict_types=1);

namespace Vendor\YourExtension\Domain\Traits;

class PostDemand
{
    /** @var bool */
    public $navHide = false;

    /** @var array */
    public $keywords = [];
}



call_user_func(static function () {

    // Load post trait collector instead of the "default" model
    $extbaseObjectContainer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\Container\Container::class);
    $extbaseObjectContainer->registerImplementation(\Zeroseven\Z7Blog\Domain\Model\Post::class, \Zeroseven\Z7Blog\Domain\Model\TraitCollector\PostTraitCollector::class);
});

// Register trait
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['z7_blog']['traits'][\Zeroseven\Z7Blog\Domain\Model\Post::class][] = \Vendor\YourExtension\Domain\Traits\PostModel::class;
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['z7_blog']['traits'][\Zeroseven\Z7Blog\Domain\Demand\PostDemand::class][] = \Vendor\YourExtension\Domain\Traits\PostDemand::class;