protected function __setMeta($property, $value, $blnOverwrite = false)
    {
        $internalMetaArray = &$this->__meta;

        /**
         * Re-set internalMetaArray if property has magic key 'label', 'field', 'tip', 'dynamicLabel'
         * or 'dynamicRemoveLabel'
         */
        $strMagicKey = null;
        foreach ($this->__magicmeta as $strMagicMeta) {
            if (strpos(strtolower($property), strtolower($strMagicMeta)) === 0
                    && strlen($property) !== strlen($strMagicMeta)) {
                $strMagicKey = $strMagicMeta;

                break;
            }
        }

        if (!is_null($strMagicKey)) {
            switch ($strMagicKey) {
                case "field":
                    $internalMetaArray = &$this->__fieldmeta;
                    $property = strtolower(substr($property, - (strlen($property) - 5)));
                    break;
                case "label":
                    $internalMetaArray = &$this->__labelmeta;
                    $property = strtolower(substr($property, - (strlen($property) - 5)));
                    break;
                case "tip":
                    $internalMetaArray = &$this->__tipmeta;
                    $property = strtolower(substr($property, - (strlen($property) - 3)));
                    break;
                case "dynamicLabel":
                    $internalMetaArray = &$this->__dynamiclabelmeta;
                    $property = strtolower(substr($property, - (strlen($property) - 12)));
                    break;
                case "dynamicRemoveLabel":
                    $internalMetaArray = &$this->__dynamicremovelabelmeta;
                    $property = strtolower(substr($property, - (strlen($property) - 18)));
                    break;
                default:
            }
        }

        if ($blnOverwrite) {
            if (empty($value) || is_null($value)) {
                unset($internalMetaArray[$property]);
            } else {
                $internalMetaArray[$property] = $value;
            }

            return $value;
        } else {
            $varMeta = (isset($internalMetaArray[$property])) ? $internalMetaArray[$property] : "";

            // *** If the id is being set and there is already a value we don't set the new value.
            if ($property == "id" && $varMeta != "") {
                return $varMeta;
            }

            // *** Define delimiter per meta property.
            switch ($property) {
                case "style":
                    $strDelimiter = ";";
                    break;

                default:
                    $strDelimiter = " ";
            }

            // *** Add the value to the property string.
            $arrMeta = (! is_array($varMeta)) ? explode($strDelimiter, $varMeta) : $varMeta;
            $arrMeta[] = $value;

            // Make sure no empty values are left in the array.
            $arrMeta = array_filter($arrMeta);

            // Make sure there are no duplicate entries for the 'class' property
            if (strtolower($property) === 'class') {
                $arrMeta = array_unique($arrMeta);
            }

            $varMeta = implode($strDelimiter, $arrMeta);

            $internalMetaArray[$property] = $varMeta;

            return $varMeta;
        }
    }
protected function __setMeta($property, $value, $blnOverwrite = false)
    {
        $internalMetaArray = &$this->__meta;

        /**
         * Re-set internalMetaArray if property has magic key 'label', 'field', 'tip', 'dynamicLabel'
         * or 'dynamicRemoveLabel'
         */
        $strMagicKey = null;
        foreach ($this->__magicmeta as $strMagicMeta) {
            if (strpos(strtolower($property), strtolower($strMagicMeta)) === 0
                    && strlen($property) !== strlen($strMagicMeta)) {
                $strMagicKey = $strMagicMeta;

                break;
            }
        }

        if (!is_null($strMagicKey)) {
            switch ($strMagicKey) {
                case "field":
                    $internalMetaArray = &$this->__fieldmeta;
                    $property = strtolower(substr($property, - (strlen($property) - 5)));
                    break;
                case "label":
                    $internalMetaArray = &$this->__labelmeta;
                    $property = strtolower(substr($property, - (strlen($property) - 5)));
                    break;
                case "tip":
                    $internalMetaArray = &$this->__tipmeta;
                    $property = strtolower(substr($property, - (strlen($property) - 3)));
                    break;
                case "dynamicLabel":
                    $internalMetaArray = &$this->__dynamiclabelmeta;
                    $property = strtolower(substr($property, - (strlen($property) - 12)));
                    break;
                case "dynamicRemoveLabel":
                    $internalMetaArray = &$this->__dynamicremovelabelmeta;
                    $property = strtolower(substr($property, - (strlen($property) - 18)));
                    break;
                default:
            }
        }

        if ($blnOverwrite) {
            if (empty($value) || is_null($value)) {
                unset($internalMetaArray[$property]);
            } else {
                $internalMetaArray[$property] = $value;
            }

            return $value;
        } else {
            $varMeta = (isset($internalMetaArray[$property])) ? $internalMetaArray[$property] : "";

            // *** If the id is being set and there is already a value we don't set the new value.
            if ($property == "id" && $varMeta != "") {
                return $varMeta;
            }

            // *** Define delimiter per meta property.
            switch ($property) {
                case "style":
                    $strDelimiter = ";";
                    break;

                default:
                    $strDelimiter = " ";
            }

            // *** Add the value to the property string.
            $arrMeta = (! is_array($varMeta)) ? explode($strDelimiter, $varMeta) : $varMeta;
            $arrMeta[] = $value;

            // Make sure no empty values are left in the array.
            $arrMeta = array_filter($arrMeta);

            // Make sure there are no duplicate entries for the 'class' property
            if (strtolower($property) === 'class') {
                $arrMeta = array_unique($arrMeta);
            }

            $varMeta = implode($strDelimiter, $arrMeta);

            $internalMetaArray[$property] = $varMeta;

            return $varMeta;
        }
    }
protected function __setMeta ( $ property , $ value , $ blnOverwrite = false ) { $ internalMetaArray = & $ this -> __meta ; /**
         * Re-set internalMetaArray if property has magic key 'label', 'field', 'tip', 'dynamicLabel'
         * or 'dynamicRemoveLabel'
         */ $ strMagicKey = null ; foreach ( $ this -> __magicmeta as $ strMagicMeta ) { if ( strpos ( strtolower ( $ property ) , strtolower ( $ strMagicMeta ) ) === 0 && strlen ( $ property ) !== strlen ( $ strMagicMeta ) ) { $ strMagicKey = $ strMagicMeta ; break ; } } if ( ! is_null ( $ strMagicKey ) ) { switch ( $ strMagicKey ) { case "field" : $ internalMetaArray = & $ this -> __fieldmeta ; $ property = strtolower ( substr ( $ property , - ( strlen ( $ property ) - 5 ) ) ) ; break ; case "label" : $ internalMetaArray = & $ this -> __labelmeta ; $ property = strtolower ( substr ( $ property , - ( strlen ( $ property ) - 5 ) ) ) ; break ; case "tip" : $ internalMetaArray = & $ this -> __tipmeta ; $ property = strtolower ( substr ( $ property , - ( strlen ( $ property ) - 3 ) ) ) ; break ; case "dynamicLabel" : $ internalMetaArray = & $ this -> __dynamiclabelmeta ; $ property = strtolower ( substr ( $ property , - ( strlen ( $ property ) - 12 ) ) ) ; break ; case "dynamicRemoveLabel" : $ internalMetaArray = & $ this -> __dynamicremovelabelmeta ; $ property = strtolower ( substr ( $ property , - ( strlen ( $ property ) - 18 ) ) ) ; break ; default : } } if ( $ blnOverwrite ) { if ( empty ( $ value ) || is_null ( $ value ) ) { unset ( $ internalMetaArray [ $ property ] ) ; } else { $ internalMetaArray [ $ property ] = $ value ; } return $ value ; } else { $ varMeta = ( isset ( $ internalMetaArray [ $ property ] ) ) ? $ internalMetaArray [ $ property ] : "" ; // *** If the id is being set and there is already a value we don't set the new value. if ( $ property == "id" && $ varMeta != "" ) { return $ varMeta ; } // *** Define delimiter per meta property. switch ( $ property ) { case "style" : $ strDelimiter = ";" ; break ; default : $ strDelimiter = " " ; } // *** Add the value to the property string. $ arrMeta = ( ! is_array ( $ varMeta ) ) ? explode ( $ strDelimiter , $ varMeta ) : $ varMeta ; $ arrMeta [ ] = $ value ; // Make sure no empty values are left in the array. $ arrMeta = array_filter ( $ arrMeta ) ; // Make sure there are no duplicate entries for the 'class' property if ( strtolower ( $ property ) === 'class' ) { $ arrMeta = array_unique ( $ arrMeta ) ; } $ varMeta = implode ( $ strDelimiter , $ arrMeta ) ; $ internalMetaArray [ $ property ] = $ varMeta ; return $ varMeta ; } }
Helper method to set meta data
@param string $property The key to set in the meta array
@param string $value The corresponding value
@param boolean $blnOverwrite If true, overwrite pre-existing key-value pair
@return array|string|null
Helper method to set meta data