public function validate()
	{
		$mandatory = $this->mandatory;
		$options = $this->getPost($this->strName);

		// Check labels only (values can be empty)
		if (\is_array($options))
		{
			foreach ($options as $key=>$option)
			{
				// Unset empty rows
				if ($option['label'] == '')
				{
					unset($options[$key]);
					continue;
				}

				$options[$key]['label'] = trim($option['label']);
				$options[$key]['value'] = trim($option['value']);

				if ($options[$key]['label'] != '')
				{
					$this->mandatory = false;
				}

				// Strip double quotes (see #6919)
				if ($options[$key]['value'] != '')
				{
					$options[$key]['value'] = str_replace('"', '', $options[$key]['value']);
				}
			}
		}

		$options = array_values($options);
		$varInput = $this->validator($options);

		if (!$this->hasErrors())
		{
			$this->varValue = $varInput;
		}

		// Reset the property
		if ($mandatory)
		{
			$this->mandatory = true;
		}
	}
public function validate()
	{
		$mandatory = $this->mandatory;
		$options = $this->getPost($this->strName);

		
		if (\is_array($options))
		{
			foreach ($options as $key=>$option)
			{
				
				if ($option['label'] == '')
				{
					unset($options[$key]);
					continue;
				}

				$options[$key]['label'] = trim($option['label']);
				$options[$key]['value'] = trim($option['value']);

				if ($options[$key]['label'] != '')
				{
					$this->mandatory = false;
				}

				
				if ($options[$key]['value'] != '')
				{
					$options[$key]['value'] = str_replace('"', '', $options[$key]['value']);
				}
			}
		}

		$options = array_values($options);
		$varInput = $this->validator($options);

		if (!$this->hasErrors())
		{
			$this->varValue = $varInput;
		}

		
		if ($mandatory)
		{
			$this->mandatory = true;
		}
	}
public function validate ( ) { $ mandatory = $ this -> mandatory ; $ options = $ this -> getPost ( $ this -> strName ) ; // Check labels only (values can be empty) if ( \ is_array ( $ options ) ) { foreach ( $ options as $ key => $ option ) { // Unset empty rows if ( $ option [ 'label' ] == '' ) { unset ( $ options [ $ key ] ) ; continue ; } $ options [ $ key ] [ 'label' ] = trim ( $ option [ 'label' ] ) ; $ options [ $ key ] [ 'value' ] = trim ( $ option [ 'value' ] ) ; if ( $ options [ $ key ] [ 'label' ] != '' ) { $ this -> mandatory = false ; } // Strip double quotes (see #6919) if ( $ options [ $ key ] [ 'value' ] != '' ) { $ options [ $ key ] [ 'value' ] = str_replace ( '"' , '' , $ options [ $ key ] [ 'value' ] ) ; } } } $ options = array_values ( $ options ) ; $ varInput = $ this -> validator ( $ options ) ; if ( ! $ this -> hasErrors ( ) ) { $ this -> varValue = $ varInput ; } // Reset the property if ( $ mandatory ) { $ this -> mandatory = true ; } }
Validate the input and set the value
Validate the input and set the value