Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/next'
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/InlineEdit/InlineEdit.php
#	src/templates/datagrid.latte
  • Loading branch information
f3l1x committed May 3, 2024
2 parents 94cd8f6 + 86c88ed commit 434108c
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/InlineEdit/InlineEdit.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ class InlineEdit
*/
protected bool $showNonEditingColumns = true;

/** @var array */

Check failure on line 61 in src/InlineEdit/InlineEdit.php

View workflow job for this annotation

GitHub Actions / Codesniffer / Codesniffer (8.3)

Property \Contributte\Datagrid\InlineEdit\InlineEdit::$dataAttributes has useless @var annotation.
protected array $dataAttributes = [];

public function __construct(protected Datagrid $grid, protected ?string $primaryWhereColumn = null)
{
$this->title = 'contributte_datagrid.edit';
Expand Down Expand Up @@ -94,6 +97,12 @@ public function renderButton(Row $row): Html

$this->tryAddIcon($a, $this->getIcon(), $this->getText());

if ($this->dataAttributes !== []) {
foreach ($this->dataAttributes as $key => $value) {
$a->data((string) $key, $value);
}
}

$a->addText($this->text);

if ($this->title !== null) {
Expand Down Expand Up @@ -122,6 +131,12 @@ public function renderButtonAdd(): Html

$this->tryAddIcon($a, $this->getIcon(), $this->getText());

if ($this->dataAttributes !== []) {
foreach ($this->dataAttributes as $key => $value) {
$a->data((string) $key, $value);
}
}

$a->addText($this->text);

if ($this->title !== null) {
Expand Down Expand Up @@ -199,4 +214,14 @@ public function showNonEditingColumns(): bool
return $this->showNonEditingColumns;
}

/**
* @return static
*/
public function setDataAttribute(string $key, mixed $value): self
{
$this->dataAttributes[$key] = $value;

return $this;
}

}

0 comments on commit 434108c

Please sign in to comment.