Skip to content

Commit

Permalink
Merge pull request #159 from vovanada/master
Browse files Browse the repository at this point in the history
Set attributes for table cell
  • Loading branch information
Nayjest authored Oct 23, 2022
2 parents 0e6671e + fee4815 commit 7812088
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Components/TableCell.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class TableCell extends HtmlTag
public function __construct(FieldConfig $column) {

$this->setColumn($column);
$this->setAttributes($column->getAttributes());
}

public function getAttributes()
Expand Down
23 changes: 23 additions & 0 deletions src/FieldConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ class FieldConfig
/** @var callable */
protected $callback;

/**
* @var array
*/
protected $attributes = [];

protected $is_hidden = false;

/**
Expand Down Expand Up @@ -332,4 +337,22 @@ public function getValue(DataRowInterface $row)
return $row->getCellValue($this);
}
}

/**
* @param array $attributes
* @return $this
*/
public function setAttributes($attributes)
{
$this->attributes = $attributes;
return $this;
}

/**
* @return array
*/
public function getAttributes()
{
return $this->attributes;
}
}

0 comments on commit 7812088

Please sign in to comment.