| [ Index ] |
PHP Cross Reference of DokuWiki |
[Summary view] [Print] [Text view]
1 <?php 2 3 namespace dokuwiki\Form; 4 5 /** 6 * Class TagCloseElement 7 * 8 * Creates an HTML close tag. You have to make sure it has been opened 9 * before or this will produce invalid HTML 10 * 11 * @package dokuwiki\Form 12 */ 13 class TagCloseElement extends ValueElement 14 { 15 /** 16 * @param string $tag 17 * @param array $attributes 18 */ 19 public function __construct($tag, $attributes = []) 20 { 21 parent::__construct('tagclose', $tag, $attributes); 22 } 23 24 /** 25 * do not call this 26 * 27 * @param string $class 28 * @return void 29 * @throws \BadMethodCallException 30 */ 31 public function addClass($class) 32 { 33 throw new \BadMethodCallException('You can\t add classes to closing tag'); 34 } 35 36 /** 37 * do not call this 38 * 39 * @param null|string $id 40 * @return string 41 * @throws \BadMethodCallException 42 */ 43 public function id($id = null) 44 { 45 if ($id === null) { 46 return ''; 47 } 48 throw new \BadMethodCallException('You can\t add ID to closing tag'); 49 } 50 51 /** 52 * do not call this 53 * 54 * @param string $name 55 * @param null|string $value 56 * @return string 57 * @throws \BadMethodCallException 58 */ 59 public function attr($name, $value = null) 60 { 61 if ($value === null) { 62 return ''; 63 } 64 throw new \BadMethodCallException('You can\t add attributes to closing tag'); 65 } 66 67 /** 68 * do not call this 69 * 70 * @param array|null $attributes 71 * @return array 72 * @throws \BadMethodCallException 73 */ 74 public function attrs($attributes = null) 75 { 76 if ($attributes === null) { 77 return []; 78 } 79 throw new \BadMethodCallException('You can\t add attributes to closing tag'); 80 } 81 82 /** 83 * The HTML representation of this element 84 * 85 * @return string 86 */ 87 public function toHTML() 88 { 89 return '</' . $this->val() . '>'; 90 } 91 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body