Merge branch '4.0' into 4

This commit is contained in:
github-actions 2024-06-19 23:42:02 +00:00
commit 406198966a
2 changed files with 12 additions and 8 deletions

View File

@ -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();

View File

@ -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
);