<?php

namespace VisualM\ManagementBundle\AdminList\Column;

use VisualM\ManagementBundle\AdminList\Column\Action\ActionInterface;
use Exception;

/**
 * Order Action Column
 *
 * Special Column where Ordering actions can be defined
 *
 * @author Visual Media
 */
class OrderActionsColumn extends ColumnConfigurationAbstract implements ColumnConfigurationInterface
{
    /**
     * Actions
     * @var array
     */
    protected $actions;

    /**
     * Constructor
     *
     * @param string $field         Field (null for no field binding)
     * @param string $title         Title
     * @param array  $actions       Actions
     */
    public function __construct($field, $title, $actions = array())
    {
        foreach($actions as $action) {
            if (!($action instanceof ActionInterface)) {
                throw new Exception("Action should be an implementation of ActionInterface");
            }
        }

        $this->actions = $actions;

        parent::__construct(
            $field,
            $title,
            true,
            'VisualMManagementBundle:AdminList:Column/OrderActions/listItem.html.twig',
            'VisualMManagementBundle:AdminList:Column/OrderActions/listHeader.html.twig',
            null
        );
    }

    /**
     * Get Actions
     *
     * @return array Actions
     */
    public function getActions()
    {
        return $this->actions;
    }

    


}