<?php

declare(strict_types=1);

namespace vonRotenberg\CoretoolsBundle\Widget;

use Contao\Widget;

class GridPosition extends Widget
{
    /**
     * @inheritdoc
     */
    protected $strTemplate = 'be_grid_position';

    protected $parent;

    protected $intCols = 6;

    protected $intRows = 1;

    public function __construct($arrAttributes = null)
    {
        parent::__construct($arrAttributes);

        $this->parent = $this->activeRecord;
    }

    public function __set($strKey, $varValue)
    {
        switch ($strKey)
        {
            case 'rows':
                $this->intRows = $varValue;
                break;

            case 'cols':
                $this->intCols = $varValue;
                break;
            default:
                parent::__set($strKey, $varValue);
                break;
        }
    }


    public function generate()
    {
        return $this->parse();
    }
}