<?php
 namespace App\Form\Input; class Autocomplete_CorporateAndOffice extends Autocomplete_GeneralAbstract { protected $class = "autocompleteCorporate"; public function __construct($label=null, $name=null, $value=null) { parent::__construct($label, $name, $value); $this->setStyle('minimumTextLength', 3); } public function getUrl() { return ($this->url?:\Engine\Mvc\Dispatcher::getInstance()->getAppUrl('Modules/RemoteData/AutocompleteFieldData', '', ['class'=>'CorporateAndOffice'])); } public function getValue() { $v = parent::getValue(); if ($v==='|') { $v = ''; } return $v; } public function determineDisplayValue($displayId) :string { if ($displayId) { $corporateDet = explode('|', $displayId); $displayValue = ''; if ($corporateDet) { $displayValue = trim( (string)\Entity\Corporate::select($corporateDet[0])->alias . ' ' . (string)\Entity\CorporateOffice::select($corporateDet[1])->name ); } return $displayValue; } return ''; } } 