Formal\Element::option PHP Method

option() public method

public option ( $sName )
    function option($sName)
    {
        if (array_key_exists($sName, $this->aOptions)) {
            return $this->aOptions[$sName];
        }
        throw new \Exception("\\Formal\\Element->option(): Option '" . htmlspecialchars($sName) . "' not found.");
    }

Usage Example

Example #1
0
 public function validateColor($sValue, \Formal\Form\Morphology $oMorpho, \Formal\Element $oElement)
 {
     if (!empty($sValue) && !preg_match("/^#[a-fA-F0-9]{6}([a-fA-F0-9]{2})?\$/", $sValue)) {
         return "<strong>" . $oElement->option("label") . "</strong> is not a valid color with format '#RRGGBB' or '#RRGGBBAA' in hexadecimal values.";
     }
     return TRUE;
 }
All Usage Examples Of Formal\Element::option