Skip to content

Commit

Permalink
remove custom delete action and orderable rows classes
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Mc Cormack committed Feb 6, 2019
1 parent 4381812 commit 368118b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 100 deletions.
41 changes: 0 additions & 41 deletions src/Action/GridFieldVersionedDeleteAction.php

This file was deleted.

43 changes: 0 additions & 43 deletions src/Action/GridFieldVersionedOrderableRows.php

This file was deleted.

22 changes: 6 additions & 16 deletions src/Extension/BlockPageExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,21 @@

namespace CyberDuck\BlockPage\Extension;

use Page;
use CyberDuck\BlockPage\Action\GridFieldVersionedContentBlockItemRequest;
use CyberDuck\BlockPage\Action\GridFieldVersionedDeleteAction;
use CyberDuck\BlockPage\Action\GridFieldVersionedOrderableRows;
use CyberDuck\BlockPage\Model\ContentBlock;
use CyberDuck\BlockPage\Model\PageContentBlock;
use SilverStripe\Control\Controller;
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\LiteralField;
use SilverStripe\Forms\GridField\GridField;
use SilverStripe\Forms\GridField\GridFieldConfig_RelationEditor;
use SilverStripe\Forms\GridField\GridFieldDeleteAction;
use SilverStripe\Forms\GridField\GridFieldDetailForm;
use SilverStripe\Forms\GridField\GridFieldPageCount;
use SilverStripe\Forms\GridField\GridFieldPaginator;
use SilverStripe\Forms\GridField\GridFieldVersionedState;
use SilverStripe\ORM\DataExtension;
use SilverStripe\ORM\DataObject;
use Symbiote\GridFieldExtensions\GridFieldOrderableRows;

class BlockPageExtension extends DataExtension
{
{
private static $db = [];

private static $many_many = [
Expand All @@ -40,18 +33,15 @@ class BlockPageExtension extends DataExtension
'ContentBlocks'
];

public function updateCMSFields(FieldList $fields)
{
if($this->owner->ID > 0) {
public function updateCMSFields(FieldList $fields)
{
if ($this->owner->ID > 0) {
$editor = GridFieldConfig_RelationEditor::create();
$grid = new GridField('ContentBlocks', 'Content Blocks', $this->owner->ContentBlocks(), $editor);
$grid->getConfig()
->removeComponentsByType(GridFieldDeleteAction::class)
->removeComponentsByType(GridFieldPageCount::class)
->removeComponentsByType(GridFieldPaginator::class)
->addComponent(new GridFieldVersionedState(['Title']))
->addComponent(new GridFieldVersionedOrderableRows('SortBlock'))
->addComponent(new GridFieldVersionedDeleteAction(true))
->addComponent(new GridFieldOrderableRows('SortBlock'))
->getComponentByType(GridFieldDetailForm::class)
->setItemRequestClass(GridFieldVersionedContentBlockItemRequest::class);

Expand All @@ -66,4 +56,4 @@ public function updateCMSFields(FieldList $fields)
$fields->addFieldToTab('Root.ContentBlocks', LiteralField::create(false, 'Please save this block to start adding items<br><br>'));
}
}
}
}

0 comments on commit 368118b

Please sign in to comment.