protected function inflateColumns($columns)
    {
        $inflatedColumns = [];

        foreach ($columns as $key => $value) {
            $tableColumn = $value;

            $label = !is_numeric($key) ? $key : null;

            if (is_string($tableColumn)) {
                $value = (string)$value;
                $tableColumn = $this->createColumnFromString($value, $label);
            } elseif (is_callable($tableColumn)) {
                $tableColumn = new ClosureColumn($label, $tableColumn);
            } elseif (!($tableColumn instanceof TableColumn)) {
                $tableColumn = $this->createColumnFromObject($tableColumn, $label);
            }

            if ($tableColumn && $tableColumn instanceof TableColumn) {
                if ($tableColumn instanceof LeafColumn) {
                    $leaf = $tableColumn->getLeaf();
                    if ($leaf instanceof BindableLeafTrait) {
                        $event = $leaf->getBindingValueRequestedEvent();
                        $event->clearHandlers();
                        $event->attachHandler(function ($dataKey, $viewIndex = false) {
                            return $this->getDataForPresenter($dataKey, $viewIndex);
                        });
                    }
                }

                $inflatedColumns[] = $tableColumn;
            }
        }

        return $inflatedColumns;
    }
protected function inflateColumns($columns)
    {
        $inflatedColumns = [];

        foreach ($columns as $key => $value) {
            $tableColumn = $value;

            $label = !is_numeric($key) ? $key : null;

            if (is_string($tableColumn)) {
                $value = (string)$value;
                $tableColumn = $this->createColumnFromString($value, $label);
            } elseif (is_callable($tableColumn)) {
                $tableColumn = new ClosureColumn($label, $tableColumn);
            } elseif (!($tableColumn instanceof TableColumn)) {
                $tableColumn = $this->createColumnFromObject($tableColumn, $label);
            }

            if ($tableColumn && $tableColumn instanceof TableColumn) {
                if ($tableColumn instanceof LeafColumn) {
                    $leaf = $tableColumn->getLeaf();
                    if ($leaf instanceof BindableLeafTrait) {
                        $event = $leaf->getBindingValueRequestedEvent();
                        $event->clearHandlers();
                        $event->attachHandler(function ($dataKey, $viewIndex = false) {
                            return $this->getDataForPresenter($dataKey, $viewIndex);
                        });
                    }
                }

                $inflatedColumns[] = $tableColumn;
            }
        }

        return $inflatedColumns;
    }
protected function inflateColumns ( $ columns ) { $ inflatedColumns = [ ] ; foreach ( $ columns as $ key => $ value ) { $ tableColumn = $ value ; $ label = ! is_numeric ( $ key ) ? $ key : null ; if ( is_string ( $ tableColumn ) ) { $ value = ( string ) $ value ; $ tableColumn = $ this -> createColumnFromString ( $ value , $ label ) ; } elseif ( is_callable ( $ tableColumn ) ) { $ tableColumn = new ClosureColumn ( $ label , $ tableColumn ) ; } elseif ( ! ( $ tableColumn instanceof TableColumn ) ) { $ tableColumn = $ this -> createColumnFromObject ( $ tableColumn , $ label ) ; } if ( $ tableColumn && $ tableColumn instanceof TableColumn ) { if ( $ tableColumn instanceof LeafColumn ) { $ leaf = $ tableColumn -> getLeaf ( ) ; if ( $ leaf instanceof BindableLeafTrait ) { $ event = $ leaf -> getBindingValueRequestedEvent ( ) ; $ event -> clearHandlers ( ) ; $ event -> attachHandler ( function ( $ dataKey , $ viewIndex = false ) { return $ this -> getDataForPresenter ( $ dataKey , $ viewIndex ) ; } ) ; } } $ inflatedColumns [ ] = $ tableColumn ; } } return $ inflatedColumns ; }
Expands the columns array, creating TableColumn objects where needed.
@param array $columns
@return TableColumn[]
Expands the columns array creating TableColumn objects where needed .