PHP code example of digitalwerk / content-element-registry
1. Go to this page and download the library: Download digitalwerk/content-element-registry 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/ */
digitalwerk / content-element-registry example snippets
namespace \YourVendor\YourExtension\ContentElement;
use Digitalwerk\ContentElementRegistry\ContentElement\AbstractContentElementRegistryItem;
class YourNewContentElement extends AbstractContentElementRegistryItem
{
}
namespace \YourVendor\YourExtension\ContentElement;
use Digitalwerk\ContentElementRegistry\ContentElement\AbstractContentElementRegistryItem;
class YourNewContentElement extends AbstractContentElementRegistryItem
{
/**
* YourNewContentElement constructor.
* @throws \Exception
*/
public function __construct()
{
parent::__construct();
$this->addPalette(
'default',
'header, --linebreak--, bodytext'
);
}
}
namespace \YourVendor\YourExtension\ContentElement;
use YourVendor\ContentElementRegistry\ContentElement\AbstractContentElementRegistryItem;
class YourNewContentElement extends AbstractContentElementRegistryItem
{
public function __construct()
{
parent::__construct();
$this->addPalette(
'default',
'tx_contentelementregistry_relations'
);
}
}
namespace \YourVendor\YourExtension\Domain\Model\ContentElement;
use DigitalWerk\ContentElementRegistry\Domain\Model\ContentElement;
/**
* Class YourNewContentElement
* @package YourVendor\YourExtension\Domain\Model\ContentElement
*/
class YourNewContentElement extends ContentElement
{
/**
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\YourVendor\YourExtension\Domain\Model\ContentElement\YourNewContentElement\YourNewRelation>
*/
protected $relations = null;
/**
* @return ObjectStorage|null
*/
public function getRelations(): ? ObjectStorage
{
return $this->relations;
}
}
namespace \YourVendor\YourExtension\Domain\Model\ContentElement\YourNewContentElement;
use Digitalwerk\ContentElementRegistry\Domain\Model\Relation;
/**
* Class YourNewRelation
* @package YourVendor\YourExtension\Domain\Model\ContentElement\YourNewContentElement
*/
class YourNewRelation extends Relation
{
/**
* @var string
*/
protected $type = '';
/**
* @return string
*/
public function getType(): string
{
return $this->type;
}
}