Skip to content

Commit

Permalink
additional fixes to cms edit link
Browse files Browse the repository at this point in the history
  • Loading branch information
xini committed Dec 22, 2020
1 parent 188c563 commit c18a31b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
17 changes: 10 additions & 7 deletions src/Model/MenuItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,16 @@
use SilverStripe\Control\Controller;
use SilverStripe\Forms\CheckboxField;
use SilverStripe\Forms\FieldGroup;
use SilverStripe\Forms\HeaderField;
use SilverStripe\Forms\OptionsetField;
use SilverStripe\Forms\TreeDropdownField;
use SilverStripe\Forms\GridField\GridField;
use SilverStripe\Forms\GridField\GridFieldAddExistingAutocompleter;
use SilverStripe\Forms\GridField\GridFieldAddNewButton;
use SilverStripe\Forms\GridField\GridFieldConfig_RecordEditor;
use SilverStripe\Forms\GridField\GridFieldPageCount;
use SilverStripe\Forms\GridField\GridFieldPaginator;
use SilverStripe\Forms\GridField\GridFieldToolbarHeader;
use SilverStripe\Forms\HeaderField;
use SilverStripe\Forms\OptionsetField;
use SilverStripe\Forms\Tab;
use SilverStripe\Forms\TreeDropdownField;
use SilverStripe\Versioned\Versioned;
use Symbiote\GridFieldExtensions\GridFieldAddNewMultiClass;
use Symbiote\GridFieldExtensions\GridFieldOrderableRows;
Expand Down Expand Up @@ -285,10 +284,13 @@ public function CMSEditLink()
{
$link = null;
if ($this->ParentID) {
$link = $this->Parent()->CMSEditLink();
$link = preg_replace('/\/item\/([\d]+)\/edit/', '/item/$1', $link);
$link = Controller::join_links(
$this->Parent()->CMSEditLink(),
$link,
'ItemEditForm/field/Children/item',
$this->ID
$this->ID,
'edit'
);
}
else if ($this->MenuSetID) {
Expand All @@ -297,7 +299,8 @@ public function CMSEditLink()
$link = Controller::join_links(
$link,
'ItemEditForm/field/Items/item',
$this->ID
$this->ID,
'edit'
);
}
$this->extend('updateCMSEditLink', $link);
Expand Down
17 changes: 11 additions & 6 deletions src/Model/MenuSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,28 @@

use Fromholdio\GridFieldLimiter\Forms\GridFieldLimiter;
use SilverStripe\Admin\LeftAndMain;
use SilverStripe\CMS\Controllers\CMSPageEditController;
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Control\Controller;
use SilverStripe\Core\ClassInfo;
use SilverStripe\Core\Config\Config;
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\HeaderField;
use SilverStripe\Forms\HiddenField;
use SilverStripe\Forms\Tab;
use SilverStripe\Forms\TabSet;
use SilverStripe\Forms\TextField;
use SilverStripe\Forms\GridField\GridField;
use SilverStripe\Forms\GridField\GridFieldAddExistingAutocompleter;
use SilverStripe\Forms\GridField\GridFieldAddNewButton;
use SilverStripe\Forms\GridField\GridFieldConfig_RecordEditor;
use SilverStripe\Forms\GridField\GridFieldPageCount;
use SilverStripe\Forms\GridField\GridFieldPaginator;
use SilverStripe\Forms\GridField\GridFieldToolbarHeader;
use SilverStripe\Forms\HeaderField;
use SilverStripe\Forms\HiddenField;
use SilverStripe\Forms\Tab;
use SilverStripe\Forms\TabSet;
use SilverStripe\Forms\TextField;
use SilverStripe\ORM\ArrayList;
use SilverStripe\ORM\DataObject;
use SilverStripe\SiteConfig\SiteConfig;
use SilverStripe\SiteConfig\SiteConfigLeftAndMain;
use SilverStripe\Versioned\Versioned;
use SilverStripe\View\SSViewer;
use Symbiote\GridFieldExtensions\GridFieldAddNewMultiClass;
Expand Down Expand Up @@ -440,7 +445,7 @@ public function getCMSFields()
$this->extend('updateCMSFields', $fields);
return $fields;
}

public function CMSEditLink()
{
$link = null;
Expand Down

0 comments on commit c18a31b

Please sign in to comment.