Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: silverstripe/silverstripe-lumberjack
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 39819bc6be2337b6dcc8870a6fa7fed87d4c5aea
Choose a base ref
..
head repository: silverstripe/silverstripe-lumberjack
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 065c2cedc3fb37decb2a293cdaf4993310f4678e
Choose a head ref
Showing with 12 additions and 12 deletions.
  1. +1 −1 client/dist/js/GridField.js
  2. +1 −1 client/src/js/GridField.js
  3. +8 −8 src/Forms/GridFieldSiteTreeAddNewButton.php
  4. +1 −1 src/Forms/GridFieldSiteTreeEditButton.php
  5. +1 −1 src/Model/Lumberjack.php
2 changes: 1 addition & 1 deletion client/dist/js/GridField.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion client/src/js/GridField.js
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@
const gridField = this.getGridField();
const state = gridField.getState().GridFieldSiteTreeAddNewButton;

state.pageType = this.val();
state.recordType = this.val();
gridField.setState('GridFieldSiteTreeAddNewButton', state);
}
});
16 changes: 8 additions & 8 deletions src/Forms/GridFieldSiteTreeAddNewButton.php
Original file line number Diff line number Diff line change
@@ -68,22 +68,22 @@ public function getHTMLFragments($gridField)
{
$state = $gridField->State->GridFieldSiteTreeAddNewButton;

$parent = SiteTree::get()->byId(Controller::curr()->currentPageID());
$parent = SiteTree::get()->byId(Controller::curr()->currentRecordID());

if ($parent) {
$state->currentPageID = $parent->ID;
$state->currentRecordID = $parent->ID;
}

$children = $this->getAllowedChildren($parent);
if (empty($children)) {
return array();
} elseif (count($children ?? []) > 1) {
$pageTypes = DropdownField::create('PageType', 'Page Type', $children, $parent->defaultChild());
$pageTypes = DropdownField::create('RecordType', 'Page Type', $children, $parent->defaultChild());
$pageTypes
->setFieldHolderTemplate(__CLASS__ . '_holder')
->addExtraClass('gridfield-dropdown no-change-track');

$state->pageType = $parent->defaultChild();
$state->RecordType = $parent->defaultChild();

if (!$this->buttonName) {
$this->buttonName = _t(
@@ -94,9 +94,9 @@ public function getHTMLFragments($gridField)
}
} else {
$keys = array_keys($children ?? []);
$pageTypes = HiddenField::create('PageType', 'Page Type', $keys[0]);
$pageTypes = HiddenField::create('RecordType', 'Page Type', $keys[0]);

$state->pageType = $keys[0];
$state->recordType = $keys[0];

if (!$this->buttonName) {
$this->buttonName = _t(
@@ -149,8 +149,8 @@ public function handleAction(GridField $gridField, $actionName, $arguments, $dat
$tmpData = $tmpData['GridFieldSiteTreeAddNewButton'];

$data = array(
'ParentID' => $tmpData['currentPageID'],
'PageType' => $tmpData['pageType']
'ParentID' => $tmpData['currentRecordID'],
'RecordType' => $tmpData['recordType']
);

$controller = Injector::inst()->create(CMSMain::class);
2 changes: 1 addition & 1 deletion src/Forms/GridFieldSiteTreeEditButton.php
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ public function getColumnContent($gridField, $record, $columnName)
// which can make the form readonly if no edit permissions are available.

$data = ArrayData::create([
'Link' => $record->CMSEditLink(),
'Link' => $record->getCMSEditLink(),
'ExtraClass' => $this->getExtraClass(),
]);

2 changes: 1 addition & 1 deletion src/Model/Lumberjack.php
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@
*
* @author Michael Strong <mstrong@silverstripe.org>
*
* @extends SiteTreeExtension<SiteTree&static>
* @extends Extension<SiteTree&static>
*/
class Lumberjack extends Extension
{