/** * Supplies properties for objects in table template specific to object configuration. * * @return array This metod is a generator. */ public function objectRows() { // Get properties as defined in object's list metadata $properties = $this->sortProperties(); // Collection objects $objects = $this->sortObjects(); // Go through each object to generate an array of properties listed in object's list metadata foreach ($objects as $object) { $objectProperties = []; foreach ($properties as $propertyIdent => $propertyData) { $property = $object->property($propertyIdent); $propertiesOptions = $this->propertiesOptions(); if (isset($propertiesOptions[$propertyIdent])) { $property->setData($propertiesOptions[$propertyIdent]); } $this->setupDisplayPropertyValue($object, $property); $displayType = $this->display->displayType(); $this->display->setPropertyVal($object->propertyValue($propertyIdent)); $propertyValue = $this->view()->renderTemplate($displayType, $this->display); $objectProperties[] = $this->parsePropertyCell($object, $property, $propertyValue); } $this->currentObj = $object; $this->currentObjId = $object->id(); $row = $this->parseObjectRow($object, $objectProperties); (yield $row); } }
/** * @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); } }