classes/hypeJunction/Prototyper/Elements/MetadataField.php
public function validate(\ElggEntity $entity) {

		$validation = new ValidationStatus();

		$metadata = get_input($this->getShortname(), array());
		$keys = array_keys(elgg_extract('value', $metadata, array()));

		if (empty($keys)) {
			if ($this->isRequired()) {
				$validation->setFail(elgg_echo('prototyper:validate:error:required', array($this->getLabel())));
			}
		} else {
			foreach ($keys as $i) {
				if ($metadata['name'][$i] == $this->getShortname()) {
					if (is_string($metadata['value'][$i])) {
						$value = strip_tags($metadata['value'][$i]);
					} else {
						$value = $metadata['value'][$i];
					}
					if (is_null($value) || $value == '') {
						if ($this->isRequired()) {
							$validation->setFail(elgg_echo('prototyper:validate:error:required', array($this->getLabel())));
						}
					} else {
						$validation = $this->applyValidationRules($value, $validation, $entity);
					}
				}
			}
		}

		return $validation;
	}
public function validate(\ElggEntity $entity) {

		$validation = new ValidationStatus();

		$metadata = get_input($this->getShortname(), array());
		$keys = array_keys(elgg_extract('value', $metadata, array()));

		if (empty($keys)) {
			if ($this->isRequired()) {
				$validation->setFail(elgg_echo('prototyper:validate:error:required', array($this->getLabel())));
			}
		} else {
			foreach ($keys as $i) {
				if ($metadata['name'][$i] == $this->getShortname()) {
					if (is_string($metadata['value'][$i])) {
						$value = strip_tags($metadata['value'][$i]);
					} else {
						$value = $metadata['value'][$i];
					}
					if (is_null($value) || $value == '') {
						if ($this->isRequired()) {
							$validation->setFail(elgg_echo('prototyper:validate:error:required', array($this->getLabel())));
						}
					} else {
						$validation = $this->applyValidationRules($value, $validation, $entity);
					}
				}
			}
		}

		return $validation;
	}
{@inheritdoc}