<?php
 namespace Engine\Form\Input; class Cloned_Autocomplete extends Autocomplete { protected $class = "clonedAutocomplete"; public function __construct($label=null, $name=null, $value=null) { parent::__construct($label, $name, $value); $this->settings['minItems'] = 1; $this->settings['showCounter'] = false; $this->settings['addLocation'] = 'bottom'; $this->settings['operations'] = []; $this->settings['operations']['add'] = true; $this->settings['operations']['remove'] = true; } public function setCloneAddLocation($location) { $this->settings['addLocation'] = $location; return $this; } public function setValue($value) { if(!is_array($value)){ $value = []; } $this->value = []; foreach ($value as $v){ $v['title'] = htmlUnclean($v['title']); $this->value[] = $v; } return $this; } protected function loadTranslations($templateClass = null) { parent::loadTranslations(); \App\Loader_Lang::getInstance()->loadAppFile('_customLoad/formField/inputs/generalAutocomplete.lang.php'); } public function getDisplayValue() { return ''; } protected function getTemplateParams($templateClass = null, $parentElement = null) { $params = parent::getTemplateParams($templateClass, $parentElement ); if (is_array($params['value'])) { foreach($params['value'] as $key=>$elem) { if ($elem['id'] and !strlen((string)$params['value'][$key]['title'])) { $params['value'][$key]['title'] = htmlUnclean( $this->determineDisplayValue($elem['id']) ); } } } return $params; } } 