TableSummaryModule::addColumnIf PHP Method

addColumnIf() public method

Add a column to the table if it satisfies the $isAllowed condition.
public addColumnIf ( boolean | string | array $isAllowed, string $key, string $name = '', array $attributes = [], string $columnClass = '' ) : TableSummaryModule
$isAllowed boolean | string | array Either a boolean to indicate whether to actually add the item or a permission string or array of permission strings (full match) to check.
$key string The key name of the column.
$name string The display-name of the column.
$attributes array The attributes for the th cell.
$columnClass string The css class to propagate to every cell in this column.
return TableSummaryModule $this
    public function addColumnIf($isAllowed, $key, $name = '', $attributes = [], $columnClass = '')
    {
        if (!$this->allowed($isAllowed)) {
            return $this;
        }
        return $this->addColumn($key, $name, $attributes, $columnClass);
    }