private function buildXMLAttributesString(Context $context) {
		$result = '';
		$matches = null;
		$attributes = $this->attributes;

		$runtimeAttributes = $context->getRuntimeAttributes();

		foreach($runtimeAttributes as $attributeName=>$runtimeAttr) {
			$attributes[$attributeName] = $runtimeAttr;
		}

		foreach($attributes as $attribute=>$value) {

			if( ! $context->view->isFigPrefix($attribute)) {
                // a flag attribute is to be processed differently because
                // it isn't a key=value pair.

                if ($value instanceof Flag) {
                    // Flag attribute: there is no value. We print only the name of the flag.
                    $result .= " $attribute";
                } else {

				    // We're potentially in presence of:
                    // - a plain scalar
                    // - an AdHoc instance
                    // - an array of the above.
                    // - an inline conditional attribute: InlineCondAttr

                    if ($value instanceof InlineCondAttr) {
                        /** @var InlineCondAttr $inlineCondAttr */
                        $inlineCondAttr = $value;
                        if ($this->evaluate($context, $inlineCondAttr->cond)) {
                            $value = $this->evaluate($context, $inlineCondAttr->val);
                        }
                        else {
                            continue;
                        }
                    }

                    if (! is_array($value)) {
                        $value = [$value];
                    }
                    $combined = '';
                    foreach ($value as $part) {
                        if ($part instanceof AdHoc) {
                            $evaluatedValue = $this->evaluate($context, $part->string);

                            if($evaluatedValue instanceof ViewElement) {
                                $evaluatedValue = $evaluatedValue->render($context);
                            }
                            if(is_array($evaluatedValue)) {
                                if(empty($evaluatedValue)) {
                                    $evaluatedValue = '';
                                } else {
                                    $message = 'Adhoc {' . $part->string . '} of attribute ' . $attribute . ' in tag "' . $this->name . '" evaluated to array.';
                                    throw new TagRenderingException($this->getTagName(), $this->getLineNumber(), $message);
                                }
                            } else if (is_object($evaluatedValue)
                                && ($evaluatedValue instanceof \DOMNode)) {

                                // Treat the special case of DOMNode descendants,
                                // for which we can evalute the text contents
                                $evaluatedValue = $evaluatedValue->nodeValue;
                            }

                            //The outcome of the evaluatedValue, coming from DB or other, might contain non-standard HTML characters.
                            //We assume that the FIG library targets HTML rendering.
                            //Therefore, let's have the outcome comply with HTML.
                            if(is_object($evaluatedValue)) {
                                //TODO: Log some warning!
                                $evaluatedValue = '### Object of class: ' . get_class($evaluatedValue) . ' ###';
                            } else {
                                $evaluatedValue = htmlspecialchars($evaluatedValue);
                            }

                            $part = $evaluatedValue;
                        }

                        // Append to what we had already (and if $part was a string in the first place,
                        // we use its direct value;
                        $combined .= $part;


                    }
                    $value = $combined;

                    $result .= " $attribute=\"$value\"";
				}
            }

        }
		return $result;
	}
private function buildXMLAttributesString(Context $context) {
		$result = '';
		$matches = null;
		$attributes = $this->attributes;

		$runtimeAttributes = $context->getRuntimeAttributes();

		foreach($runtimeAttributes as $attributeName=>$runtimeAttr) {
			$attributes[$attributeName] = $runtimeAttr;
		}

		foreach($attributes as $attribute=>$value) {

			if( ! $context->view->isFigPrefix($attribute)) {
                // a flag attribute is to be processed differently because
                // it isn't a key=value pair.

                if ($value instanceof Flag) {
                    // Flag attribute: there is no value. We print only the name of the flag.
                    $result .= " $attribute";
                } else {

				    // We're potentially in presence of:
                    // - a plain scalar
                    // - an AdHoc instance
                    // - an array of the above.
                    // - an inline conditional attribute: InlineCondAttr

                    if ($value instanceof InlineCondAttr) {
                        /** @var InlineCondAttr $inlineCondAttr */
                        $inlineCondAttr = $value;
                        if ($this->evaluate($context, $inlineCondAttr->cond)) {
                            $value = $this->evaluate($context, $inlineCondAttr->val);
                        }
                        else {
                            continue;
                        }
                    }

                    if (! is_array($value)) {
                        $value = [$value];
                    }
                    $combined = '';
                    foreach ($value as $part) {
                        if ($part instanceof AdHoc) {
                            $evaluatedValue = $this->evaluate($context, $part->string);

                            if($evaluatedValue instanceof ViewElement) {
                                $evaluatedValue = $evaluatedValue->render($context);
                            }
                            if(is_array($evaluatedValue)) {
                                if(empty($evaluatedValue)) {
                                    $evaluatedValue = '';
                                } else {
                                    $message = 'Adhoc {' . $part->string . '} of attribute ' . $attribute . ' in tag "' . $this->name . '" evaluated to array.';
                                    throw new TagRenderingException($this->getTagName(), $this->getLineNumber(), $message);
                                }
                            } else if (is_object($evaluatedValue)
                                && ($evaluatedValue instanceof \DOMNode)) {

                                // Treat the special case of DOMNode descendants,
                                // for which we can evalute the text contents
                                $evaluatedValue = $evaluatedValue->nodeValue;
                            }

                            //The outcome of the evaluatedValue, coming from DB or other, might contain non-standard HTML characters.
                            //We assume that the FIG library targets HTML rendering.
                            //Therefore, let's have the outcome comply with HTML.
                            if(is_object($evaluatedValue)) {
                                //TODO: Log some warning!
                                $evaluatedValue = '### Object of class: ' . get_class($evaluatedValue) . ' ###';
                            } else {
                                $evaluatedValue = htmlspecialchars($evaluatedValue);
                            }

                            $part = $evaluatedValue;
                        }

                        // Append to what we had already (and if $part was a string in the first place,
                        // we use its direct value;
                        $combined .= $part;


                    }
                    $value = $combined;

                    $result .= " $attribute=\"$value\"";
				}
            }

        }
		return $result;
	}
private function buildXMLAttributesString ( Context $ context ) { $ result = '' ; $ matches = null ; $ attributes = $ this -> attributes ; $ runtimeAttributes = $ context -> getRuntimeAttributes ( ) ; foreach ( $ runtimeAttributes as $ attributeName => $ runtimeAttr ) { $ attributes [ $ attributeName ] = $ runtimeAttr ; } foreach ( $ attributes as $ attribute => $ value ) { if ( ! $ context -> view -> isFigPrefix ( $ attribute ) ) { // a flag attribute is to be processed differently because // it isn't a key=value pair. if ( $ value instanceof Flag ) { // Flag attribute: there is no value. We print only the name of the flag. $ result .= " $attribute" ; } else { // We're potentially in presence of: // - a plain scalar // - an AdHoc instance // - an array of the above. // - an inline conditional attribute: InlineCondAttr if ( $ value instanceof InlineCondAttr ) { /** @var InlineCondAttr $inlineCondAttr */ $ inlineCondAttr = $ value ; if ( $ this -> evaluate ( $ context , $ inlineCondAttr -> cond ) ) { $ value = $ this -> evaluate ( $ context , $ inlineCondAttr -> val ) ; } else { continue ; } } if ( ! is_array ( $ value ) ) { $ value = [ $ value ] ; } $ combined = '' ; foreach ( $ value as $ part ) { if ( $ part instanceof AdHoc ) { $ evaluatedValue = $ this -> evaluate ( $ context , $ part -> string ) ; if ( $ evaluatedValue instanceof ViewElement ) { $ evaluatedValue = $ evaluatedValue -> render ( $ context ) ; } if ( is_array ( $ evaluatedValue ) ) { if ( empty ( $ evaluatedValue ) ) { $ evaluatedValue = '' ; } else { $ message = 'Adhoc {' . $ part -> string . '} of attribute ' . $ attribute . ' in tag "' . $ this -> name . '" evaluated to array.' ; throw new TagRenderingException ( $ this -> getTagName ( ) , $ this -> getLineNumber ( ) , $ message ) ; } } else if ( is_object ( $ evaluatedValue ) && ( $ evaluatedValue instanceof \ DOMNode ) ) { // Treat the special case of DOMNode descendants, // for which we can evalute the text contents $ evaluatedValue = $ evaluatedValue -> nodeValue ; } //The outcome of the evaluatedValue, coming from DB or other, might contain non-standard HTML characters. //We assume that the FIG library targets HTML rendering. //Therefore, let's have the outcome comply with HTML. if ( is_object ( $ evaluatedValue ) ) { //TODO: Log some warning! $ evaluatedValue = '### Object of class: ' . get_class ( $ evaluatedValue ) . ' ###' ; } else { $ evaluatedValue = htmlspecialchars ( $ evaluatedValue ) ; } $ part = $ evaluatedValue ; } // Append to what we had already (and if $part was a string in the first place, // we use its direct value; $ combined .= $ part ; } $ value = $ combined ; $ result .= " $attribute=\"$value\"" ; } } } return $ result ; }
Returns a string containing the space-separated
list of XML attributes of an element.

@param Context $context
@return string
@throws TagRenderingException
Returns a string containing the space - separated list of XML attributes of an element .