for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace DNADesign\Elemental\Models;
use SilverStripe\Forms\FieldList;
use SilverStripe\ORM\FieldType\DBField;
class ElementContent extends BaseElement
{
private static $icon = 'font-icon-block-content';
$icon
private static $db = [
$db
'HTML' => 'HTMLText'
];
private static $table_name = 'ElementContent';
$table_name
private static $singular_name = 'content block';
$singular_name
private static $plural_name = 'content blocks';
$plural_name
private static $description = 'HTML text block';
$description
/**
* Re-title the HTML field to Content
*
* {@inheritDoc}
*/
public function getCMSFields()
$this->beforeUpdateCMSFields(function (FieldList $fields) {
$fields
->fieldByName('Root.Main.HTML')
->setTitle(_t(__CLASS__ . '.ContentLabel', 'Content'));
});
return parent::getCMSFields();
}
public function getSummary()
return DBField::create_field('HTMLText', $this->HTML)->Summary(20);
HTML
DNADesign\Elemental\Models\ElementContent
__get
protected function provideBlockSchema()
$blockSchema = parent::provideBlockSchema();
$blockSchema['content'] = $this->getSummary();
return $blockSchema;
public function getType()
return _t(__CLASS__ . '.BlockType', 'Content');