Closed goatwriter closed 9 years ago
Hi, I'm glad you like the module.
The blocks editing gridfield is being added via the PageBlocks
Extension.
In your getCMSFields
method you could remove and re-add the blocks editing field at a position of your liking, even in a separate Tab. Example:
public function getCMSFields()
{
$fields = parent::getCMSFields();
if($blockEditor = $fields->fieldByName('Root.Main.Blocks')){
$fields->remove($blockEditor);
$fields->addFieldsToTab('Root.Blocks', $blockEditor);
}
return $fields;
}
Regarding the Block Title. It's meant as a content-title, but of course you're free to omit it. If you just want to change the title of the form-field inside the CMS, just override the title inside your own lang files. Eg. in your mysite/lang/en.yml
add the following:
en:
Block:
TITLE: Name or ID
Word of advice: Never change code inside modules or the framework. You'll run into a lot of problems if you plan to update your SilverStripe installation down the road. It's better to subclass/extend or write custom DataExtensions.
Excellent. Yeah I wasn't comfortable tinkering in the file. I wasn't aware of the option to overwrite the name in a lang file - seems to work perfectly - thanks!
I only wanted the blocks further down the Main tab so I used your same suggestion but tweaked the add line to:
$fields->addFieldsToTab('Root.Main', $blockEditor, 'myOtherFieldNameToComeAfterBlocks');
Thanks for your help.
Hi,
I am pretty new to Silverstripe but have been using your module today and really like it - thanks.
Just one thing, and forgive me if this is more of a framework thing than for your module, how can I dictate where the entire page-blocks section appears on my CMS page? At the moment it appears at the top, under the page title bits but before other fields I have set for the page. I'd like it to appear further down so it is more intuitive for admin users.
I also am not sure about calling each block 'title', for me it's more of a name or an ID. I figured out how to edit your code to insert a description so the user knows that it is not a content title. This is a small issue and wouldn't affect everyone, but just passing the feedback. Thanks.