/** * @param TagInterface $tag * @param string $content * @return string */ public function render(TagInterface $tag, $content = '') { $result = $this->template; $result = str_replace('{content}', $content, $result); $result = str_replace('{value}', $tag->getValue(), $result); foreach ($tag->getAttributes() as $name => $value) { $result = str_replace('{' . $name . '}', $value, $result); } return $result; }
/** * Renders the list of attributes including the leading space. * * @param TagInterface $tag * @return string */ protected function renderAttributes(TagInterface $tag) { $result = ''; foreach ($tag->getAttributes() as $key => $value) { $result .= ' ' . $key . '="' . $value . '"'; } return $result; }