mirror of
https://github.com/symbiote/silverstripe-gridfieldextensions.git
synced 2024-10-22 17:05:39 +02:00
Merge branch '4.0' into 4
This commit is contained in:
commit
406198966a
@ -131,7 +131,7 @@ class GridFieldAddNewInlineButton extends AbstractGridFieldComponent implements
|
|||||||
$field->setName(sprintf(
|
$field->setName(sprintf(
|
||||||
'%s[%s][{%%=o.num%%}][%s]',
|
'%s[%s][{%%=o.num%%}][%s]',
|
||||||
$grid->getName(),
|
$grid->getName(),
|
||||||
self::POST_KEY,
|
GridFieldAddNewInlineButton::POST_KEY,
|
||||||
$field->getName()
|
$field->getName()
|
||||||
));
|
));
|
||||||
|
|
||||||
@ -145,7 +145,7 @@ class GridFieldAddNewInlineButton extends AbstractGridFieldComponent implements
|
|||||||
// Convert GridFieldEditableColumns to the template format
|
// Convert GridFieldEditableColumns to the template format
|
||||||
$content = str_replace(
|
$content = str_replace(
|
||||||
sprintf('[%s][0]', GridFieldEditableColumns::POST_KEY),
|
sprintf('[%s][0]', GridFieldEditableColumns::POST_KEY),
|
||||||
sprintf('[%s][{%%=o.num%%}]', self::POST_KEY),
|
sprintf('[%s][{%%=o.num%%}]', GridFieldAddNewInlineButton::POST_KEY),
|
||||||
$content ?? ''
|
$content ?? ''
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -176,7 +176,9 @@ class GridFieldAddNewInlineButton extends AbstractGridFieldComponent implements
|
|||||||
$list = $grid->getList();
|
$list = $grid->getList();
|
||||||
$value = $grid->Value();
|
$value = $grid->Value();
|
||||||
|
|
||||||
if (!isset($value[self::POST_KEY]) || !is_array($value[self::POST_KEY])) {
|
if (!isset($value[GridFieldAddNewInlineButton::POST_KEY])
|
||||||
|
|| !is_array($value[GridFieldAddNewInlineButton::POST_KEY])
|
||||||
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,7 +192,7 @@ class GridFieldAddNewInlineButton extends AbstractGridFieldComponent implements
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($value[self::POST_KEY] as $fields) {
|
foreach ($value[GridFieldAddNewInlineButton::POST_KEY] as $fields) {
|
||||||
/** @var DataObject $item */
|
/** @var DataObject $item */
|
||||||
$item = $class::create();
|
$item = $class::create();
|
||||||
|
|
||||||
|
@ -121,7 +121,9 @@ class GridFieldEditableColumns extends GridFieldDataColumns implements
|
|||||||
$list = $grid->getList();
|
$list = $grid->getList();
|
||||||
$value = $grid->Value();
|
$value = $grid->Value();
|
||||||
|
|
||||||
if (!isset($value[self::POST_KEY]) || !is_array($value[self::POST_KEY])) {
|
if (!isset($value[GridFieldEditableColumns::POST_KEY])
|
||||||
|
|| !is_array($value[GridFieldEditableColumns::POST_KEY])
|
||||||
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,13 +131,13 @@ class GridFieldEditableColumns extends GridFieldDataColumns implements
|
|||||||
$sortable = $grid->getConfig()->getComponentByType(GridFieldOrderableRows::class);
|
$sortable = $grid->getConfig()->getComponentByType(GridFieldOrderableRows::class);
|
||||||
|
|
||||||
// Fetch the items before processing them
|
// Fetch the items before processing them
|
||||||
$ids = array_keys($value[self::POST_KEY]);
|
$ids = array_keys($value[GridFieldEditableColumns::POST_KEY]);
|
||||||
if (empty($ids)) {
|
if (empty($ids)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$itemsCollection = ArrayList::create($list->filter('ID', $ids)->toArray());
|
$itemsCollection = ArrayList::create($list->filter('ID', $ids)->toArray());
|
||||||
|
|
||||||
foreach ($value[self::POST_KEY] as $id => $fields) {
|
foreach ($value[GridFieldEditableColumns::POST_KEY] as $id => $fields) {
|
||||||
if (!is_numeric($id) || !is_array($fields)) {
|
if (!is_numeric($id) || !is_array($fields)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -325,7 +327,7 @@ class GridFieldEditableColumns extends GridFieldDataColumns implements
|
|||||||
return sprintf(
|
return sprintf(
|
||||||
'%s[%s][%s][%s]',
|
'%s[%s][%s][%s]',
|
||||||
$grid->getName(),
|
$grid->getName(),
|
||||||
self::POST_KEY,
|
GridFieldEditableColumns::POST_KEY,
|
||||||
$record->ID,
|
$record->ID,
|
||||||
$name
|
$name
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user