Skip to content

Commit

Permalink
Update skip write component config get/set name
Browse files Browse the repository at this point in the history
Internally the variables are private, so name isn't a big issue there.

Internally to DataObject the method calls are `writeComponents` (called
from `write`) and `skipWriteComponents()`, which is why the get/set
functions in the EditableColumns component were named that way.

However it is a bit confusing, and the variables that are passed can be
either boolean, or a configuration array (which isn't very well
documented by core)... adding to the confusion.

By calling it a "write config" it is a bit clearer the purpose of the
function calls and what the author of consuming code intends to happen
at that point. This came as feedback on the [original PR][1]

[1]: #350
  • Loading branch information
NightJar committed Nov 25, 2024
1 parent d1f2b89 commit 9f84046
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/GridFieldEditableColumns.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class GridFieldEditableColumns extends GridFieldDataColumns implements
/**
* @return bool|array
*/
public function getSkipWriteComponents()
public function getComponentWriteConfig()
{
return $this->skipWriteComponents;
}
Expand All @@ -75,7 +75,7 @@ public function getSkipWriteComponents()
* @param bool|array $skipConfig
* @return $this
*/
public function setSkipWriteComponents($skipConfig)
public function setComponentWriteConfig($skipConfig)
{
$this->skipWriteComponents = $skipConfig;
return $this;
Expand Down Expand Up @@ -187,7 +187,7 @@ public function handleSave(GridField $grid, DataObjectInterface $record)
$extra = array_intersect_key($form->getData(), (array) $list->getExtraFields());
}

$item->write(false, false, false, $this->getSkipWriteComponents());
$item->write(false, false, false, $this->getComponentWriteConfig());
$list->add($item, $extra);
}
}
Expand Down

0 comments on commit 9f84046

Please sign in to comment.