/** * @return PropertyInputInterface */ public function input() { $prop = $this->prop(); /** @todo Needs fix. Must be manually triggered after setting data for metadata to work */ $metadata = $prop->metadata(); $inputType = $this->inputType(); $this->input = $this->propertyInputFactory()->create($inputType); $this->input->setInputType($inputType); $this->input->setProperty($prop); $this->input->setPropertyVal($this->propertyVal); $this->input->setData($prop->data()); $this->input->setViewController($this->viewController()); if (isset($metadata['admin'])) { $this->input->setData($metadata['admin']); } $GLOBALS['widget_template'] = $inputType; $res = []; if ($this->loopL10n() && $prop->l10n()) { $langs = $this->availableLanguages(); $inputId = $this->input->inputId(); foreach ($langs as $lang) { // Set a unique input ID for language. $this->input->setInputId($inputId . '_' . $lang); $this->input->setLang($lang); (yield $this->input); } } else { (yield $this->input); } }