Backend\Core\Engine\DataGrid::addColumn PHP Method

addColumn() public method

Adds a new column
public addColumn ( string $name, string $label = null, string $value = null, string $url = null, string $title = null, string $image = null, integer $sequence = null )
$name string The name for the new column.
$label string The label for the column.
$value string The value for the column.
$url string The URL for the link inside the column.
$title string A title for the image inside the column.
$image string An URL to the image inside the column.
$sequence integer The sequence for the column.
    public function addColumn($name, $label = null, $value = null, $url = null, $title = null, $image = null, $sequence = null)
    {
        // make sure we use a lowercased column in all checks
        $lowercasedName = mb_strtolower($name);
        $icon = $this->decideIcon($name);
        // known actions that should have a button
        if (in_array($lowercasedName, array('add', 'edit', 'delete', 'detail', 'details', 'approve', 'mark_as_spam', 'install'))) {
            // rebuild value, it should have special markup
            $value = '<a href="' . $url . '" class="btn btn-default btn-xs pull-right">' . ($icon ? '<span class="fa ' . $icon . '"></span>&nbsp;' : '') . $value . '</a>';
            // reset URL
            $url = null;
        }
        if (in_array($lowercasedName, array('use_revision', 'use_draft'))) {
            // rebuild value, it should have special markup
            $value = '<a href="' . $url . '" class="btn btn-default btn-xs">' . ($icon ? '<span class="fa ' . $icon . '"></span>&nbsp;' : '') . $value . '</a>';
            // reset URL
            $url = null;
        }
        // add the column
        parent::addColumn($name, $label, $value, $url, $title, $image, $sequence);
        // known actions
        if (in_array($lowercasedName, array('add', 'edit', 'delete', 'detail', 'details', 'approve', 'mark_as_spam', 'install', 'use_revision', 'use_draft'))) {
            // add special attributes for actions we know
            $this->setColumnAttributes($name, array('class' => 'fork-data-grid-action action' . \SpoonFilter::toCamelCase($name)));
        }
        // set header attributes
        $this->setColumnHeaderAttributes($name, array('class' => $name));
    }