Hi. Being new to SilverStrip I have the latest version and the latest elemental installed. Unfortunately many of the examples are for an older version of elemental (I assume) and I get an error trying to install them. The lesson on building a new block is a broken link. There is other info around but I’m a bit confused which is for V3 and which is V4.
I want to create a pair of block types that will render content on the left and the right of a page that is structured so:
[full width block]
[left] [right]
[full width block]
So far I have created a skeleton “left block” class under app\src called ElementLeftBlock.php:
<?php
namespace SilverStripe\GVM\Blocks;
use DNADesign\Elemental\Models\BaseElement;
class ElementLeftBlock extends BaseElement {
private static $singular_name = 'Left Block';
private static $plural_name = 'Left Blocks';
private static $description = 'A block of content rendered on the LHS of a page';
public function getType() {
return 'Left Block';
}
public function getCMSFields() {
$fields = parent::getCMSFields();
return $fields;
}
}
and a template in SilverStripe\GVM\Blocks
<% if $ShowTitle %>
<h2 class="left-element__title">$Title</h2>
<% end_if %>
<div class="left-element__container">
<h2>This is the left hand block</h2>
$HTML
</div>
so far, so good and I can see adiv is being injected into my page source.
<div class="element silverstripe__gvm__blocks__elementleftblock" id="e2">
<div class="left-element__container">
<h2>This is the left hand block</h2>
</div>
</div>
However my new block does not have a content editor in the CMS to add HTML. That’s strange as I read that the framework adds an editor by default unless you turn it off.