Render listBox field row

@access public

@param IFormModel $model model
@param string $property model property
@param array $options attribute array

@return string
976313
public function listBoxFieldRow(IFormModel $model, $property, array $options = [])
    {
        $element = $this->getField($model, $property);
        $options['id'] = $element['id'];

        return Html::openTag('div', $this->getBlock('block', $options)).
        Html::label($model->getLabel($property), $element['id'], $this->getBlock('label', $options)).
        $this->listBoxField($model, $property, $options).
        Html::closeTag('div');
    }
81665
public function renderValue($value, array $options = []): string
    {
        $object = isset($options['object']) ? $options['object'] : null;
        $column = isset($options['column']) ? $options['column'] : null;
        $attributeCode = isset($options['attribute']) ? $options['attribute'] : null;
        if ($column instanceof Column && null === $attributeCode) {
            $attributeCode = $column->getPropertyPath();
        }

        if ($object instanceof DataInterface && $attributeCode) {
            try {
                $attribute = $object->getFamily()->getAttribute($attributeCode);
            } catch (\Exception $e) {
                // do nothing, it's okay
                return $this->parent->renderValue($value, $options);
            }
            $formOptions = $attribute->getFormOptions();
            if (!isset($formOptions['choices'])
                || !\in_array($attribute->getType()->getCode(), $this->choiceTypes, true)
            ) {
                return $this->parent->renderValue($value, $options);
            }
            $key = array_search($value, $formOptions['choices'], true);
            if (false !== $key) {
                $translationDomain = null;
                if (array_key_exists('choice_translation_domain', $formOptions)) {
                    $translationDomain = $formOptions['choice_translation_domain'];
                }
                if (false === $translationDomain) {
                    return $key;
                }

                return $this->translator->trans($key, [], $translationDomain);
            }
        }

        return $this->parent->renderValue($value, $options);
    }
814974
public function radioButtonListFieldRow(IFormModel $model, $property, array $options = [])
    {
        $element = $this->getField($model, $property);
        $options['id'] = $element['id'];

        return Html::openTag('div', $this->getBlock('block', $options)).
        Html::label($model->getLabel($property), $element['id'], $this->getBlock('label', $options)).
        $this->radioButtonListField($model, $property, $options).
        Html::closeTag('div');
    }
253477
public function telField(IFormModel $model, $property, array $options = [])
    {
        $element = $this->getField($model, $property);
        $options['id'] = $element['id'];

        return Html::telField($element['name'], $element['value'], $options);
    }
469287
public function buildConstraint($fieldName, Schema $property, DocumentModel $model, array $options)
    {
        $enumValue = array_reduce(
            $options,
            function ($carry, $option) {
                if ($option->name == 'choices') {
                    return explode('|', $option->value);
                }
            }
        );

        // is this a numeric field? convert values
        if (in_array('integer', $property->getType()->getTypes())) {
            $enumValue = array_map('intval', $enumValue);
        }

        if (is_array($enumValue)) {
            $property->setEnum($enumValue);
        }

        return $property;
    }
1084532
private function renderParentProperty(EnvironmentInterface $environment, $property, $value)
    {
        $evaluation = $property->getExtra();

        if (\is_array($value)) {
            return \implode(', ', $value);
        }

        $isRendered = false;

        $value = $this->renderForCheckbox($property, $value, $isRendered);
        $value = $this->renderForDateTime($environment, $property, $value, $isRendered);
        $value = $this->renderReference($value, $evaluation['reference'], $isRendered);

        $options = $property->getOptions();
        if ($evaluation['isAssociative'] || \array_is_assoc($options)) {
            $value = $options[$value];
        }

        return $value;
    }
720813
public function renderProperty($model, $property, $view, $form = null)
    {
        return $this->render(
            $this->convertView($view),
            [
                'model' => $model,
                'property' => $property,
                'form' => $form
            ]
        );
    }
1219557
protected function prepareImageRules(Model $model, $property, $fieldName, $field)
    {
        $getter = 'get'.studly_case($property);
        $setter = 'set'.studly_case($property);

        if (! method_exists($model, $getter) || ! method_exists($model, $setter)) {
            throw new \Exception('Unexpected missing method on model '.get_class($model));
        }

        // Calculate minimum allowed image size.
        list($minWidth, $minHeight) = $model->getMinAllowedImageSize($field);
        // Set dimensions on the model.
        $model->setMinDimensions($fieldName, ['width' => $minWidth, 'height' => $minHeight]);

        $modelRules = $model->$getter();

        $restrictions = [];
        if ($minWidth) {
            $restrictions[] = 'min_width='.$minWidth;
        }
        if ($minHeight) {
            $restrictions[] = 'min_height='.$minHeight;
        }

        // Find actual field name
        // Try to get the field config for the image.
        foreach ($model->getFormFields() as $formFieldName => $config) {
            if ($config['type'] == 'gallery' && isset($config['image_field']) && $config['image_field'] == $fieldName) {
                $fieldName = $formFieldName;
                break;
            }
        }

        // Prepare model rules.
        if (isset($modelRules[$fieldName])) {
            // We need to get widget config
            $rules = explode('|', $modelRules[$fieldName]);

            $fieldConfig = $model->getFormField($fieldName);
            if ($fieldConfig['type'] == 'gallery') {
                // we need to remove the required attribute as we validate elsewhere
                if (($requiredKey = array_search('required', $rules)) !== false) {
                    $rules[$requiredKey] = 'gallery_required:'.get_class($model);
                    $this->requiredImages[$fieldName] = $fieldName;
                }
            }

            if (strstr($modelRules[$fieldName], 'max:') === false) {
                if ($maxImageSize = config('ignicms.images.max_upload_size')) {
                    $rules[] = 'max:'.$maxImageSize;
                    $modelRules[$fieldName] = 'dimensions:'.implode(',', $restrictions).
                        '|max:'.$maxImageSize;
                }
            }
            // Check to see for dimensions rule and remove it.
            if (strstr($modelRules[$fieldName], 'dimensions:') !== false) {
                foreach ($rules as $key => $rule) {
                    if (strstr($rule, 'dimensions:') !== false) {
                        unset($rules[$key]);
                    }
                }
            }
            $rules[] = 'dimensions:'.implode(',', $restrictions);
            $modelRules[$fieldName] = implode('|', $rules);
        } else {
            $modelRules[$fieldName] = '';
            if ($maxImageSize = config('ignicms.images.max_upload_size')) {
                $modelRules[$fieldName] .= 'max:'.$maxImageSize.'|';
            }
            $modelRules[$fieldName] .= 'dimensions:'.implode(',', $restrictions);
        }

        $model->$setter($modelRules);
    }
1154807
public function renderField(Model $model, $attribute, array $settings = [])
    {
        $fieldOptions = ArrayHelper::getValue($settings, 'fieldOptions', []);
        $field = $this->field($model, $attribute, $fieldOptions);

        if (($label = ArrayHelper::getValue($settings, 'label')) !== null) {
            $field->label($label, ArrayHelper::getValue($settings, 'labelOptions', []));
        }
        if (($hint = ArrayHelper::getValue($settings, 'hint')) !== null) {
            $field->hint($hint, ArrayHelper::getValue($settings, 'hintOptions', []));
        }

        $type = ArrayHelper::getValue($settings, 'type', static::INPUT_TEXT);
        $this->prepareField($field, $type, $settings);

        return $field;
    }
126625
public function dateTimeLocalFieldRow(IFormModel $model, $property, array $options = [])
    {
        $element = $this->getField($model, $property);
        $options['id'] = $element['id'];

        return Html::openTag('div', $this->getBlock('block', $options)).
        Html::label($model->getLabel($property), $element['id'], $this->getBlock('label', $options)).
        $this->dateTimeLocalField($model, $property, $options).
        Html::closeTag('div');
    }
1336210
public function render(Field $field, $data, array $options)
    {
        $value = $this->dataExtractor->get($field, $data);
        if (null === $value) {
            return null;
        }

        Assert::isInstanceOf($value, \DateTimeInterface::class);

        return $value->format($options['format']);
    }
64486
protected function _render_one_field($field, $options)
    {
        $name = $options['name'] ?? $field;
        $type = $this->getSQLFieldType($options['type'] ?? null, $options);

        return $this->_escape($name).' '.$type;
    }
169747
private function renderProperties(MetadataInterface $metadata, array $options)
    {
        $properties = array_replace_recursive(
            $options['defaults'],
            array_filter($metadata->toArray(), function ($item) { return null !== $item; })
        );

        $renderedProperties = [];
        foreach ($properties as $propertyKey => $propertyValue) {
            if (null === $propertyValue) {
                continue;
            }

            $this->ensurePropertyIsKnown($metadata, $propertyKey);

            $renderedProperties[] = sprintf(
                '<meta name="%s" content="%s" />',
                $this->keysToNames[$propertyKey],
                htmlentities($propertyValue, \ENT_COMPAT)
            );
        }

        return $renderedProperties;
    }
639890
public function render()
	{
		if ($this->getDisplayField() === null) {
			throw new \InvalidArgumentException(sprintf('Please provide a display field for the `%s` relation via the display(); method.', $this->getName()));
		}

		switch ($this->getContext()) {
			case BaseField::CONTEXT_LIST:
				$value = $this->getValue();
				return $value->{$this->getDisplayField()};
				break;

			case BaseField::CONTEXT_FILTER:
                $baseModel  = $this->getAdmin()->getModel();
                $baseModel  = new $baseModel;
				$primaryKey = $baseModel->getKeyName();

                $relatedModel = $baseModel->{$this->getName()}()->getRelated();

                $items = [];
                foreach ($relatedModel::all() as $item) {
                    $items[$item->{$primaryKey}] = $item->{$this->getDisplayField()};
                }

                $column = Str::singular($relatedModel->getTable()) . '_id';
                if (Input::has($column)) {
                    $this->setValue(Input::get($column));
                }

				return View::make('krafthaus/bauhaus::models.fields._belongs_to')
					->with('field', $this)
					->with('items', $items);
				break;

			case BaseField::CONTEXT_FORM:
				$baseModel  = $this->getAdmin()->getModel();
				$baseModel  = new $baseModel;
				$primaryKey = $baseModel->getKeyName();

				$relatedModel = $baseModel->{$this->getName()}()->getRelated();

				$items = [];
				foreach ($relatedModel::all() as $item) {
					$items[$item->{$primaryKey}] = $item->{$this->getDisplayField()};
				}

				if ($this->getValue() !== null) {
					$this->setValue($this->getValue()->{$primaryKey});
				}

				return View::make('krafthaus/bauhaus::models.fields._belongs_to')
					->with('field', $this)
					->with('items', $items);

				break;
		}

		return $this->getValue();
	}
308275
static public function renderField($value, array $options, $item)
    {
        if (empty($options['name'])) {
            return '';
        }
        if (empty($value) || !is_array($value)) {
            return '';
        }

        if (!$item instanceof EntityInterface) {
            return '';
        }

        $output = field_view_field($item->getEntityTypeId(), $item, $options['name'], self::LIST_VIEW_MODE);

        return drupal_render($output);
    }
1101550
public function passwordFieldRow(IFormModel $model, $property, array $options = [])
    {
        $element = $this->getField($model, $property);
        $options['id'] = $element['id'];

        return Html::openTag('div', $this->getBlock('block', $options)).
        Html::label($model->getLabel($property), $element['id'], $this->getBlock('label', $options)).
        $this->passwordField($model, $property, $options).
        Html::closeTag('div');
    }
222690
public function render()
	{
		if ($this->getDisplayField() === null) {
			throw new \InvalidArgumentException(sprintf('Please provide a display field for the `%s` relation.', $this->getName()));
		}

		switch ($this->getContext()) {
			case BaseField::CONTEXT_LIST:
				$baseModel    = $this->getAdmin()->getModel();
				$baseModel    = new $baseModel;

				$relatedModel = $baseModel->{$this->getName()}()->getRelated();
				$primaryKey   = $relatedModel->getKeyName();

				$values = [];
				foreach ($this->getValue() as $item) {
					$values[$item->{$primaryKey}] = $item->{$this->getDisplayField()};
				}

				return implode(', ', $values);

				break;
			case BaseField::CONTEXT_FORM:
				$baseModel  = $this->getAdmin()->getModel();
				$baseModel  = new $baseModel;
				$primaryKey = $baseModel->getKeyName();

				$relatedModel = $baseModel->{$this->getName()}()->getRelated();

				$items = [];
				foreach ($relatedModel::all() as $item) {
					$items[$item->{$primaryKey}] = $item->{$this->getDisplayField()};
				}

				$id = $this->getAdmin()->getFormBuilder()->getIdentifier();
				$values = [];

				if ($id !== null) {
					foreach ($baseModel::find($id)->{$relatedModel->getTable()} as $item) {
						$values[$item->{$primaryKey}] = $item->{$primaryKey};
					}
				}

				return View::make('krafthaus/bauhaus::models.fields._belongs_to_many')
					->with('field',  $this)
					->with('items',  $items)
					->with('values', $values);
		}
	}