<?php

namespace App\Form\Input;

class Cloned_KeyValue extends \Engine\Form\Input\ElementAbstract
{
	// this will determine the CSS and TPL files used, it will be overwritten by each class that extends this one
	protected $class = "clonedKeyValue";

	/**
	 * The max length of the code field (is applied using maxlength in HTML).
	 * @var Int
	 */
	protected $codeMaxLength=null;

	public function __construct($label=null, $name=null, $value=null)
	{
		parent::__construct($label, $name, $value);

		$this->settings['minItems'] = 1;

		$this->settings['operations'] = [];
		$this->settings['operations']['add'] = true;
		$this->settings['operations']['remove'] = true;
		$this->settings['operations']['move'] = true;
	}

	/**
	 * Sets the maxlength attribute for all codes.
	 * @param Int $maxLen
	 * @return self
	 */
	public function setCodeMaxlength($maxLen)
	{
		$this->codeMaxLength=$maxLen;
		return $this;
	}

	/**
	 * Returns the maxlength attribute for all codes.
	 * @return Int
	 */
	public function getCodeMaxlength()
	{
		return $this->codeMaxLength;
	}

}
