Changeset View
Changeset View
Standalone View
Standalone View
src/view/AphrontTagView.php
| Show First 20 Lines • Show All 86 Lines • ▼ Show 20 Lines | abstract class AphrontTagView extends AphrontView { | ||||
| protected function getTagContent() { | protected function getTagContent() { | ||||
| return $this->renderChildren(); | return $this->renderChildren(); | ||||
| } | } | ||||
| final public function render() { | final public function render() { | ||||
| $this->willRender(); | $this->willRender(); | ||||
| // A tag view may render no tag at all. For example, the HandleListView is | |||||
| // a container which renders a tag in HTML mode, but can also render in | |||||
| // text mode without producing a tag. When a tag view has no tag name, just | |||||
| // return the tag content as though the view did not exist. | |||||
| $tag_name = $this->getTagName(); | |||||
| if ($tag_name === null) { | |||||
| return $this->getTagContent(); | |||||
| } | |||||
| $attributes = $this->getTagAttributes(); | $attributes = $this->getTagAttributes(); | ||||
| $implode = array('class', 'sigil'); | $implode = array('class', 'sigil'); | ||||
| foreach ($implode as $attr) { | foreach ($implode as $attr) { | ||||
| if (isset($attributes[$attr])) { | if (isset($attributes[$attr])) { | ||||
| if (is_array($attributes[$attr])) { | if (is_array($attributes[$attr])) { | ||||
| $attributes[$attr] = implode(' ', $attributes[$attr]); | $attributes[$attr] = implode(' ', $attributes[$attr]); | ||||
| } | } | ||||
| Show All 39 Lines | foreach ($tag_view_attributes as $key => $value) { | ||||
| default: | default: | ||||
| // Use the explicitly set value rather than the tag default value. | // Use the explicitly set value rather than the tag default value. | ||||
| $attributes[$key] = $value; | $attributes[$key] = $value; | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| return javelin_tag( | return javelin_tag( | ||||
| $this->getTagName(), | $tag_name, | ||||
| $attributes, | $attributes, | ||||
| $this->getTagContent()); | $this->getTagContent()); | ||||
| } | } | ||||
| } | } | ||||