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