public function replaceNode(TemplateEngine $tplEngine, ElementNode $node) { // DATA $value = $node->getAttribute('href')->value; $node->removeAttribute('href'); $node->namespace = null; $node->tagName = 'link'; $cssRevisionData = $tplEngine->getData('css_revision'); $cssRevision = isset($cssRevisionData) ? '?' . $cssRevisionData : null; $node->addAttribute(new HtmlAttribute('href', $value . $cssRevision)); }
public function replaceNode(TemplateEngine $tplEngine, ElementNode $node) { // DATA $sels = $node->getAttribute('selection')->value; $selsStr = '$this->getDataFromSelector(\'' . $sels . '\')'; $value = $node->getAttribute('value')->value; $node->removeAttribute('selection'); $node->namespace = null; $node->tagName = 'input'; if ($sels !== null) { $node->tagExtension = " <?php echo ((is_array({$selsStr}) && in_array({$value}, {$selsStr})) || ({$selsStr} == '{$value}'))?' checked':null; ?>"; } $node->addAttribute(new HtmlAttribute('type', 'checkbox')); }
public function replaceNode(TemplateEngine $tplEngine, ElementNode $node) { // DATA $sels = $node->getAttribute('selection')->value; $valueAttr = $node->getAttribute('value')->value; $value = is_numeric($valueAttr) ? $valueAttr : "'" . $valueAttr . "'"; $type = $node->getAttribute('type')->value; $node->removeAttribute('selection'); $node->namespace = null; $node->tagName = 'input'; if ($sels !== null) { $node->tagExtension = " <?php echo in_array({$value}, \$this->getData('{$sels}'))?' checked=\"checked\"':null; ?>"; } $node->addAttribute(new HtmlAttribute('type', $type)); }