/** * Set the attributes on the html tags according to the attributes that are * assigned in the model for a certain element * * @param \DOMElement $domElement DOM element of the specific HTML tag * @return void */ public function setAttributes(\DOMElement $domElement) { $attributes = $this->model->getAttributes(); foreach ($attributes as $key => $attribute) { if (!empty($attribute)) { $value = htmlspecialchars($attribute->getValue(), ENT_QUOTES); if ($value !== '') { $domElement->setAttribute($key, $value); } } } }
/** * Set the attributes on the html tags according to the attributes that are * assigned in the model for a certain element * * @param DOMElement $domElement DOM element of the specific HTML tag * @return void */ public function setAttributes(\DOMElement $domElement) { $attributes = $this->model->getAttributes(); foreach ($attributes as $key => $attribute) { if (!empty($attribute)) { $value = $attribute->getValue(); if (!empty($value)) { $domElement->setAttribute($key, $value); } } } }