1 module uim.html.elements; 2 3 import uim.html.core; 4 5 public import uim.html.elements.mixins; 6 7 public import uim.html.elements.a; 8 public import uim.html.elements.abbr; 9 public import uim.html.elements.address; 10 public import uim.html.elements.area; 11 public import uim.html.elements.article; 12 public import uim.html.elements.aside; 13 public import uim.html.elements.audio; 14 public import uim.html.elements.b; 15 public import uim.html.elements.base; 16 public import uim.html.elements.bdi; 17 public import uim.html.elements.bdo; 18 public import uim.html.elements.big; 19 public import uim.html.elements.blockquote; 20 public import uim.html.elements.body_; 21 public import uim.html.elements.br; 22 public import uim.html.elements.button; 23 public import uim.html.elements.canvas; 24 public import uim.html.elements.caption; 25 public import uim.html.elements.cite; 26 public import uim.html.elements.code; 27 public import uim.html.elements.col; 28 public import uim.html.elements.colgroup; 29 public import uim.html.elements.comment; 30 public import uim.html.elements.content; 31 public import uim.html.elements.data; 32 public import uim.html.elements.datalist; 33 public import uim.html.elements.dd; 34 public import uim.html.elements.decorator; 35 public import uim.html.elements.del; 36 public import uim.html.elements.details; 37 public import uim.html.elements.dfn; 38 public import uim.html.elements.dialog; 39 public import uim.html.elements.div; 40 public import uim.html.elements.dl; 41 public import uim.html.elements.dt; 42 public import uim.html.elements.element; 43 public import uim.html.elements.em; 44 public import uim.html.elements.embed; 45 public import uim.html.elements.fieldset; 46 public import uim.html.elements.figcaption; 47 public import uim.html.elements.figure; 48 public import uim.html.elements.footer; 49 public import uim.html.elements.form; 50 public import uim.html.elements.h; 51 public import uim.html.elements.head; 52 public import uim.html.elements.header; 53 public import uim.html.elements.hr; 54 public import uim.html.elements.html; 55 public import uim.html.elements.i; 56 public import uim.html.elements.iframe; 57 public import uim.html.elements.img; 58 public import uim.html.elements.input; 59 public import uim.html.elements.inputs; 60 public import uim.html.elements.ins; 61 public import uim.html.elements.kbd; 62 public import uim.html.elements.keygen; 63 public import uim.html.elements.label; 64 public import uim.html.elements.legend; 65 public import uim.html.elements.li; 66 public import uim.html.elements.link; 67 public import uim.html.elements.list; 68 public import uim.html.elements.main_; 69 public import uim.html.elements.map; 70 public import uim.html.elements.mark; 71 public import uim.html.elements.math; 72 public import uim.html.elements.menu; 73 public import uim.html.elements.menuitem; 74 public import uim.html.elements.meta; 75 public import uim.html.elements.meter; 76 public import uim.html.elements.nav; 77 public import uim.html.elements.noscript; 78 public import uim.html.elements.object; 79 public import uim.html.elements.ol; 80 public import uim.html.elements.optgroup; 81 public import uim.html.elements.option; 82 public import uim.html.elements.output; 83 public import uim.html.elements.p; 84 public import uim.html.elements.param; 85 public import uim.html.elements.picture; 86 public import uim.html.elements.pre; 87 public import uim.html.elements.progress; 88 public import uim.html.elements.q; 89 public import uim.html.elements.rbc; 90 public import uim.html.elements.rp; 91 public import uim.html.elements.rt; 92 public import uim.html.elements.rtc; 93 public import uim.html.elements.ruby; 94 public import uim.html.elements.s; 95 public import uim.html.elements.samp; 96 public import uim.html.elements.script; 97 public import uim.html.elements.section; 98 public import uim.html.elements.select; 99 public import uim.html.elements.shadow; 100 public import uim.html.elements.slot; 101 public import uim.html.elements.small; 102 public import uim.html.elements.source; 103 public import uim.html.elements.span; 104 public import uim.html.elements.strong; 105 public import uim.html.elements.style; 106 public import uim.html.elements.sub; 107 public import uim.html.elements.summary; 108 public import uim.html.elements.sup; 109 public import uim.html.elements.svg; 110 public import uim.html.elements.table; 111 public import uim.html.elements.tbody; 112 public import uim.html.elements.td; 113 public import uim.html.elements.textarea; 114 public import uim.html.elements.template_; 115 public import uim.html.elements.tfoot; 116 public import uim.html.elements.th; 117 public import uim.html.elements.thead; 118 public import uim.html.elements.time; 119 public import uim.html.elements.title; 120 public import uim.html.elements.tr; 121 public import uim.html.elements.track; 122 public import uim.html.elements.u; 123 public import uim.html.elements.ul; 124 public import uim.html.elements.var; 125 public import uim.html.elements.video; 126 public import uim.html.elements.wbr; 127 128 enum HTML = "HTML"; 129 enum HEAD = "HEAD"; 130 enum BODY = "BODY"; 131 enum LINK = "LINK"; 132 enum Script = "Script"; 133 enum Div = "Div"; 134 enum A = "A"; 135 enum BIG = "BIG"; 136 enum TITLE = "TITLE"; 137 enum META = "META"; 138 enum STYLE = "STYLE"; 139 enum BASE = "BASE"; 140 enum HEADER = "HEADER"; 141 enum NAV = "NAV"; 142 enum ASIDE = "ASIDE"; 143 enum ADDRESS = "ADDRESS"; 144 enum MAIN = "MAIN"; 145 enum SECTION = "SECTION"; 146 enum ARTICLE = "ARTICLE"; 147 enum FOOTER = "FOOTER"; 148 enum H1 = "H1"; 149 enum H2 = "H2"; 150 enum H3 = "H3"; 151 enum H4 = "H4"; 152 enum P = "P"; 153 enum PRE = "PRE"; 154 enum BLOCKQUOTE = "BLOCKQUOTE"; 155 enum FIGURE = "FIGURE"; 156 enum FIGCAPTION = "FIGCAPTION"; 157 enum OL = "OL"; 158 enum UL = "UL"; 159 enum DL = "DL"; 160 enum LI = "LI"; 161 enum DT = "DT"; 162 enum DD = "DD"; 163 enum HR = "HR"; 164 enum B = "B"; 165 enum EM = "EM"; 166 enum I = "I"; 167 enum KBD = "KBD"; 168 enum MARK = "MARK"; 169 enum S = "S"; 170 enum SMALL = "SMALL"; 171 enum STRONG = "STRONG"; 172 enum SUB = "SUB"; 173 enum SUP = "SUP"; 174 enum U = "U"; 175 enum CITE = "CITE"; 176 enum Q = "Q"; 177 enum DFN = "DFN"; 178 enum ABBR = "ABBR"; 179 enum CODE = "CODE"; 180 enum VAR = "VAR"; 181 enum SAMP = "SAMP"; 182 enum TIME = "TIME"; 183 enum RUBY = "RUBY"; 184 enum RT = "RT"; 185 enum RP = "RP"; 186 enum BDI = "BDI"; 187 enum BDO = "BDO"; 188 enum BR = "BR"; 189 enum WBR = "WBR"; 190 enum DEL = "DEL"; 191 enum INS = "INS"; 192 enum SPAN = "SPAN"; 193 enum TABLE = "TABLE"; 194 enum CAPTION = "CAPTION"; 195 enum COL = "COL"; 196 enum COLGROUP = "COLGROUP"; 197 enum THEAD = "THEAD"; 198 enum TBODY = "TBODY"; 199 enum TFOOT = "TFOOT"; 200 enum TR = "TR"; 201 enum TH = "TH"; 202 enum TD = "TD"; 203 enum MAP = "MAP"; 204 enum AREA = "AREA"; 205 enum IMG = "IMG"; 206 enum PICTURE = "PICTURE"; 207 enum CANVAS = "CANVAS"; 208 enum SVG = "SVG"; 209 enum MATH = "MATH"; 210 enum IFRAME = "IFRAME"; 211 enum EMBED = "EMBED"; 212 enum OBJECT = "OBJECT"; 213 enum PARAM = "PARAM"; 214 enum AUDIO = "AUDIO"; 215 enum VIDEO = "VIDEO"; 216 enum SOURCE = "SOURCE"; 217 enum TRACK = "TRACK"; 218 enum FORM = "FORM"; 219 enum FIELDSET = "FIELDSET"; 220 enum LEGEND = "LEGEND"; 221 enum LABEL = "LABEL"; 222 enum DATALIST = "DATALIST"; 223 enum INPUT = "INPUT"; 224 enum Button = "Button"; 225 enum SELECT = "SELECT"; 226 enum OPTGROUP = "OPTGROUP"; 227 enum OPTION = "OPTION"; 228 enum TEXTAREA = "TEXTAREA"; 229 enum KEYGEN = "KEYGEN"; 230 enum OUTPUT = "OUTPUT"; 231 enum PROGRESS = "PROGRESS"; 232 enum METER = "METER"; 233 enum NOScript = "NOScript"; 234 enum CONTENT = "CONTENT"; 235 enum DECORATOR = "DECORATOR"; 236 enum ELEMENT = "ELEMENT"; 237 enum SHADOW = "SHADOW"; 238 enum TEMPLATE = "TEMPLATE"; 239 enum DETAILS = "DETAILS"; 240 enum SUMMARY = "SUMMARY"; 241 enum DIALOG = "DIALOG"; 242 enum MENU = "MENU"; 243 enum MENUITEM = "MENUITEM"; 244 enum COMMAND = "COMMAND"; 245 246 /* 247 class DH5 { 248 // Grundstruktur 249 static auto HTML() { return new DH5HTML(); } 250 static auto HEAD() { return new DH5HEAD(); } 251 static auto BODY() { return new DH5BODY(); } 252 253 // Kopfdaten 254 static auto TITLE() { return new DH5TITLE(); } 255 static auto META() { return new DH5META(); } 256 static auto LINK() { return new DH5LINK(); } 257 static auto STYLE() { return new DH5STYLE(); } 258 static auto BASE() { return new DH5BASE(); } 259 260 // Seitenstrukturierung 261 static auto HEADER() { return new DH5HEADER(); } 262 static auto NAV() { return new DH5NAV(); } 263 static auto ASIDE() { return new DH5ASIDE(); } 264 static auto MAIN() { return new DH5MAIN(); } 265 static auto SECTION() { return new DH5SECTION(); } 266 static auto ARTICLE() { return new DH5ARTICLE(); } 267 static auto ADDRESS() { return new DH5ADDRESS(); } 268 static auto FOOTER() { return new DH5FOOTER(); } 269 static auto H1() { return new DH5H1; } 270 static auto H2() { return new DH5H2; } 271 static auto H3() { return new DH5H3; } 272 static auto H4() { return new DH5H4; } 273 static auto H5() { return new DH5H5; } 274 static auto H6() { return new DH5H6; } 275 276 // Textstrukturierung 277 static auto P() { return new DH5P(); } 278 static auto PRE() { return new DH5PRE(); } 279 static auto BLOCKQUOTE() { return new DH5BLOCKQUOTE(); } 280 static auto FIGCAPTION() { return new DH5FIGCAPTION(); } 281 static auto FIGURE() { return new DH5FIGURE(); } 282 static auto OL() { return new DH5OL(); } 283 static auto UL() { return new DH5UL(); } 284 static auto DL() { return new DH5DL(); } 285 static auto LI() { return new DH5LI(); } 286 static auto DT() { return new DH5DT(); } 287 static auto DD() { return new DH5DD(); } 288 static auto HR() { return new DH5HR(); } 289 static auto Div() { return new DH5Div(); } 290 291 // Textauszeichnung 292 static auto B() { return new DH5B(); } 293 static auto EM() { return new DH5EM(); } 294 static auto I() { return new DH5I(); } 295 static auto KBD() { return new DH5KBD(); } 296 static auto MARK() { return new DH5MARK(); } 297 static auto S() { return new DH5S(); } 298 static auto SMALL() { return new DH5SMALL(); } 299 static auto STRONG() { return new DH5STRONG(); } 300 static auto SUB() { return new DH5SUB(); } 301 static auto SUP() { return new DH5SUP(); } 302 static auto U() { return new DH5U(); } 303 static auto CITE() { return new DH5CITE(); } 304 static auto Q() { return new DH5Q(); } 305 static auto DFN() { return new DH5DFN(); } 306 // static auto ABBR() { return new DH5ABBR(); } 307 static auto CODE() { return new DH5CODE(); } 308 static auto VAR() { return new DH5VAR(); } 309 static auto SAMP() { return new DH5SAMP(); } 310 static auto TIME() { return new DH5TIME(); } 311 static auto RUBY() { return new DH5RUBY(); } 312 static auto RT() { return new DH5RT(); } 313 static auto RP() { return new DH5RP(); } 314 static auto BDI() { return new DH5BDI(); } 315 static auto BDO() { return new DH5BDO(); } 316 static auto BR() { return new DH5BR(); } 317 static auto WBR() { return new DH5WBR(); } 318 static auto DEL() { return new DH5DEL(); } 319 static auto INS() { return new DH5INS(); } 320 static auto SPAN() { return new DH5SPAN(); } 321 322 // Tabellen 323 static auto TABLE() { return new DH5TABLE(); } 324 static auto CAPTION() { return new DH5CAPTION(); } 325 static auto COL() { return new DH5COL(); } 326 static auto COLGROUP() { return new DH5COLGROUP(); } 327 static auto THEAD() { return new DH5THEAD(); } 328 static auto TBODY() { return new DH5TBODY(); } 329 static auto TFOOT() { return new DH5TFOOT(); } 330 static auto TR() { return new DH5TR(); } 331 static auto TH() { return new DH5TH(); } 332 static auto TD() { return new DH5TD(); } 333 334 // Links (Verweise) 335 // static auto A() { return new DH5A(); } 336 static auto MAP() { return new DH5MAP(); } 337 static auto AREA() { return new DH5AREA(); } 338 339 // Multimedia und Grafiken 340 static auto IMG() { return new DH5IMG(); } 341 static auto PICTURE() { return new DH5PICTURE(); } 342 static auto CANVAS() { return new DH5CANVAS(); } 343 static auto SVG() { return new DH5SVG(); } 344 static auto MATH() { return new DH5MATH(); } 345 static auto IFRAME() { return new DH5IFRAME(); } 346 static auto EMBED() { return new DH5EMBED(); } 347 static auto OBJECT() { return new DH5OBJECT(); } 348 static auto PARAM() { return new DH5PARAM(); } 349 static auto AUDIO() { return new DH5AUDIO(); } 350 static auto VIDEO() { return new DH5VIDEO(); } 351 static auto SOURCE() { return new DH5SOURCE(); } 352 static auto TRACK() { return new DH5TRACK(); } 353 354 // Formulare 355 static auto FORM() { return new DH5FORM(); } 356 static auto FIELDSET() { return new DH5FIELDSET(); } 357 static auto LEGEND() { return new DH5LEGEND(); } 358 static auto LABEL() { return new DH5LABEL(); } 359 static auto DATALIST() { return new DH5DATALIST(); } 360 static auto INPUT() { return new DH5INPUT(); } 361 static auto Button() { return new DH5Button(); } 362 static auto SELECT() { return new DH5SELECT(); } 363 static auto OPTGROUP() { return new DH5OPTGROUP(); } 364 static auto OPTION() { return new DH5OPTION(); } 365 static auto TEXTAREA() { return new DH5TEXTAREA(); } 366 static auto KEYGEN() { return new DH5KEYGEN(); } 367 static auto OUTPUT() { return new DH5OUTPUT(); } 368 static auto PROGRESS() { return new DH5PROGRESS(); } 369 static auto METER() { return new DH5METER(); } 370 371 // Skripte 372 static auto Script() { return new DH5Script(); } 373 static auto NOScript() { return new DH5NOScript(); } 374 static auto CONTENT() { return new DH5CONTENT(); } 375 static auto DECORATOR() { return new DH5DECORATOR(); } 376 // static auto ELEMENT() { return new DH5ELEMENT(); } 377 static auto SHADOW() { return new DH5SHADOW(); } 378 // static auto TEMPLATE() { return new DH5TEMPLATE(); } 379 380 // Interaktive Elemente 381 static auto DETAILS() { return new DH5DETAILS(); } 382 static auto SUMMARY() { return new DH5SUMMARY(); } 383 static auto DIALOG() { return new DH5DIALOG(); } 384 static auto MENU() { return new DH5MENU(); } 385 static auto MENUITEM() { return new DH5MENUITEM(); } 386 static auto COMMAND() { return new DH5COMMAND(); } 387 388 //static auto opCall(string val) { 389 // switch(val) { 390 // case "HTML": return new DH5HTML(); 391 // case "HEAD": return new DH5HEAD(); 392 // case "BODY": return new DH5BODY(); 393 // case "TITLE": return new DH5TITLE(); 394 // case "META": return new DH5META(); 395 // case "LINK": return new DH5LINK(); 396 // case "STYLE": return new DH5STYLE(); 397 // case "BASE": return new DH5BASE(); 398 // case "HEADER": return new DH5HEADER(); 399 // case "NAV": return new DH5NAV(); 400 // case "ASIDE": return new DH5ASIDE(); 401 // case "MAIN": return new DH5MAIN(); 402 // case "SECTION": return new DH5SECTION(); 403 // case "ARTICLE": return new DH5ARTICLE(); 404 // case "ADDRESS": return new DH5ADDRESS(); 405 // case "FOOTER": return new DH5FOOTER(); 406 // case "BIG": return new DH5BIG(); 407 // case "H1": return new DH5H1; 408 // case "H2": return new DH5H2; 409 // case "H3": return new DH5H3; 410 // case "H4": return new DH5H4; 411 // case "H5": return new DH5H5; 412 // case "H6": return new DH5H6; 413 // case "P": return new DH5P(); 414 // case "PRE": return new DH5PRE(); 415 // case "BLOCKQUOTE": return new DH5BLOCKQUOTE(); 416 // case "FIGCAPTION": return new DH5FIGCAPTION(); 417 // case "FIGURE": return new DH5FIGURE(); 418 // case "OL": return new DH5OL(); 419 // case "UL": return new DH5UL(); 420 // case "DL": return new DH5DL(); 421 // case "LI": return new DH5LI(); 422 // case "DT": return new DH5DT(); 423 // case "DD": return new DH5DD(); 424 // case "HR": return new DH5HR(); 425 // case "Div": return new DH5Div(); 426 // case "B": return new DH5B(); 427 // case "EM": return new DH5EM(); 428 // case "I": return new DH5I(); 429 // case "KBD": return new DH5KBD(); 430 // case "MARK": return new DH5MARK(); 431 // case "S": return new DH5S(); 432 // case "SMALL": return new DH5SMALL(); 433 // case "STRONG": return new DH5STRONG(); 434 // case "SUB": return new DH5SUB(); 435 // case "SUP": return new DH5SUP(); 436 // case "U": return new DH5U(); 437 // case "CITE": return new DH5CITE(); 438 // case "Q": return new DH5Q(); 439 // case "DFN": return new DH5DFN(); 440 // // case "ABBR": return new DH5ABBR(); 441 // case "CODE": return new DH5CODE(); 442 // case "VAR": return new DH5VAR(); 443 // case "SAMP": return new DH5SAMP(); 444 // case "TIME": return new DH5TIME(); 445 // case "RUBY": return new DH5RUBY(); 446 // case "RT": return new DH5RT(); 447 // case "RP": return new DH5RP(); 448 // case "BDI": return new DH5BDI(); 449 // case "BDO": return new DH5BDO(); 450 // case "BR": return new DH5BR(); 451 // case "WBR": return new DH5WBR(); 452 // case "DEL": return new DH5DEL(); 453 // case "INS": return new DH5INS(); 454 // case "SPAN": return new DH5SPAN(); 455 // case "TABLE": return new DH5TABLE(); 456 // case "CAPTION": return new DH5CAPTION(); 457 // case "COL": return new DH5COL(); 458 // case "COLGROUP": return new DH5COLGROUP(); 459 // case "THEAD": return new DH5THEAD(); 460 // case "TBODY": return new DH5TBODY(); 461 // case "TFOOT": return new DH5TFOOT(); 462 // case "TR": return new DH5TR(); 463 // case "TH": return new DH5TH(); 464 // case "TD": return new DH5TD(); 465 // case "A": return new DH5A(); 466 // case "MAP": return new DH5MAP(); 467 // case "AREA": return new DH5AREA(); 468 // case "IMG": return new DH5IMG(); 469 // case "PICTURE": return new DH5PICTURE(); 470 // case "CANVAS": return new DH5CANVAS(); 471 // case "SVG": return new DH5SVG(); 472 // case "MATH": return new DH5MATH(); 473 // case "IFRAME": return new DH5IFRAME(); 474 // case "EMBED": return new DH5EMBED(); 475 // case "OBJECT": return new DH5ElementECT(); 476 // case "PARAM": return new DH5PARAM(); 477 // case "AUDIO": return new DH5AUDIO(); 478 // case "VIDEO": return new DH5VIDEO(); 479 // case "SOURCE": return new DH5SOURCE(); 480 // case "TRACK": return new DH5TRACK(); 481 // case "FORM": return new DH5FORM(); 482 // case "FIELDSET": return new DH5FIELDSET(); 483 // case "LEGEND": return new DH5LEGEND(); 484 // case "LABEL": return new DH5LABEL(); 485 // case "DATALIST": return new DH5DATALIST(); 486 // case "INPUT": return new DH5INPUT(); 487 // case "Button": return new DH5Button(); 488 // case "SELECT": return new DH5SELECT(); 489 // case "OPTGROUP": return new DH5OPTGROUP(); 490 // case "OPTION": return new DH5OPTION(); 491 // case "TEXTAREA": return new DH5TEXTAREA(); 492 // case "KEYGEN": return new DH5KEYGEN(); 493 // case "OUTPUT": return new DH5OUTPUT(); 494 // case "PROGRESS": return new DH5PROGRESS(); 495 // case "METER": return new DH5METER(); 496 // case "Script": return new DH5Script(); 497 // case "NOScript": return new DH5NOScript(); 498 // case "CONTENT": return new DH5CONTENT(); 499 // case "DECORATOR": return new DH5DECORATOR(); 500 // // case "ELEMENT": return new DH5ELEMENT(); 501 // case "SHADOW": return new DH5SHADOW(); 502 // case "TEMPLATE": return new DH5TEMPLATE(); 503 // case "DETAILS": return new DH5DETAILS(); 504 // case "SUMMARY": return new DH5SUMMARY(); 505 // case "DIALOG": return new DH5DIALOG(); 506 // case "MENU": return new DH5MENU(); 507 // case "MENUITEM": return new DH5MENUITEM(); 508 // case "COMMAND": return new DH5COMMAND(); 509 // default: return null; 510 // } 511 // } 512 // static DH5Root opCall(string val, string[string] atts) { 513 // auto h5 = H5(val); 514 // h5.attributes = atts; 515 // return h5; 516 // } 517 // static DH5Root opCall(string val, string[] texts...) { 518 // auto h5 = H5(val); 519 // h5 << texts; 520 // return h5; 521 // } 522 } 523 // template H5(string name) { mixin("DH5"~name~" h5 = new DH5"~name~"();"); } 524 525 //auto H5()() { return new DH5Root(); } 526 //auto H5(string name)() { return DH5(name); } 527 //auto H5(string name)(string[string] attributes) { return DH5(name).add(attributes); } 528 //auto H5(string name)(DObject[] elements...) { return DH5(name).add(elements); } 529 //auto H5(string name)(string[] texts...) { return DH5(name).add(texts); } 530 //auto H5(string name)(string[string] attributes, DObject[] elements...) { return DH5(name).add(attributes).add(elements); } 531 //auto H5(string name)(string[string] attributes, string[] texts...) { return DH5(name).add(attributes).add(texts); } 532 533 // Extras 534 535 //string H5(string predicate)(string content = "") { 536 // string result; 537 // 538 // foreach (number; numbers) { 539 // if (mixin (predicate)) { 540 // result ~= number; 541 // } 542 // } 543 // 544 // return result; 545 //} 546 547 548 //auto H5()() { return new DH5Root(); } 549 //auto H5(string name)() { return DH5(name); } 550 //auto H5(string name)(string[string] attributes) { return DH5(name).add(attributes); } 551 //auto H5(string name)(DObject[] elements...) { return DH5(name).add(elements); } 552 //auto H5(string name)(string[] texts...) { return DH5(name).add(texts); } 553 //auto H5(string name)(string[string] attributes, DObject[] elements...) { return DH5(name).add(attributes).add(elements); } 554 //auto H5(string name)(string[string] attributes, string[] texts...) { return DH5(name).add(attributes).add(texts); } 555 */ 556 557 /** 558 * module uim.html; 559 560 import std.stdio; 561 import std.string; 562 563 /* 564 Class 565 All Classes | Properties | Methods 566 Inheritance 567 Subclasses yii\bootstrap\BaseHtml, yii\bootstrap\Html, yii\helpers\Html 568 Available since version 2.0 569 Source Code https://github.com/yiisoft/yii2/blob/master/framework/helpers/BaseHtml.php 570 BaseHtml provides concrete implementation for yii\helpers\Html. 571 572 Do not use BaseHtml. Use yii\helpers\Html instead. 573 574 Public Properties 575 Hide inherited properties 576 577 Property Type Description Defined By 578 $attributeOrder array The preferred order of attributes in a tag. 579 $dataAttributes array List of tag attributes that should be specially handled when their values are of array type. 580 $voidElements array List of void elements (element name => 1) 581 */ 582 // Public Methods 583 584 // Generates a hyperlink tag. 585 //string a(string text, string url = null, string[string] options = null) { 586 // if (!url) { 587 // // $options['href'] = Url::to($url); 588 // } 589 // return dtag("a", text, options); 590 //} 591 /* 592 activeCheckbox() Generates a checkbox tag together with a label for the given model attribute. 593 activeCheckboxList() Generates a list of checkboxes. 594 activeDropDownList() Generates a drop-down list for the given model attribute. 595 activeFileInput() Generates a file input tag for the given model attribute. 596 activeHiddenInput() Generates a hidden input tag for the given model attribute. 597 activeHint() Generates a hint tag for the given model attribute. 598 activeInput() Generates an input tag for the given model attribute. 599 activeLabel() Generates a label tag for the given model attribute. 600 activeListBox() Generates a list box. 601 activePasswordInput() Generates a password input tag for the given model attribute. 602 activeRadio() Generates a radio button tag together with a label for the given model attribute. 603 activeRadioList() Generates a list of radio buttons. 604 activeTextInput() Generates a text input tag for the given model attribute. 605 activeTextarea() Generates a textarea tag for the given model attribute. 606 addCssClass() Adds a CSS class (or several classes) to the specified options. 607 addCssStyle() Adds the specified CSS style to the HTML options. 608 beginForm() Generates a form start tag. 609 beginTag() Generates a start tag. 610 button() Generates a button tag. 611 buttonInput() Generates an input button. 612 checkbox() Generates a checkbox input. 613 checkboxList() Generates a list of checkboxes. 614 csrfMetaTags() Generates the meta tags containing CSRF token information. 615 cssFile() Generates a link tag that refers to an external CSS file. 616 cssStyleFromArray() Converts a CSS style array into a string representation. 617 cssStyleToArray() Converts a CSS style string into an array representation. 618 decode() Decodes special HTML entities back to the corresponding characters. 619 dropDownList() Generates a drop-down list. 620 encode() Encodes special characters into HTML entities. 621 endForm() Generates a form end tag. 622 endTag() Generates an end tag. 623 error() Generates a tag that contains the first validation error of the specified model attribute. 624 errorSummary() Generates a summary of the validation errors. 625 escapeJsRegularExpression() Escapes regular expression to use in JavaScript 626 fileInput() Generates a file input field. 627 getAttributeName() Returns the real attribute name from the given attribute expression. 628 getAttributeValue() Returns the value of the specified attribute name or expression. 629 getInputId() Generates an appropriate input ID for the specified attribute name or expression. 630 getInputName() Generates an appropriate input name for the specified attribute name or expression. 631 hiddenInput() Generates a hidden input field. 632 img() Generates an image tag. 633 input() Generates an input type of the given type. 634 jsFile() Generates a script tag that refers to an external JavaScript file. 635 label() Generates a label tag. 636 listBox() Generates a list box. 637 mailto() Generates a mailto hyperlink. 638 ol() Generates an ordered list. 639 passwordInput() Generates a password input field. 640 radio() Generates a radio button input. 641 radioList() Generates a list of radio buttons. 642 removeCssClass() Removes a CSS class from the specified options. 643 removeCssStyle() Removes the specified CSS style from the HTML options. 644 renderSelectOptions() Renders the option tags that can be used by dropDownList() and listBox(). 645 renderTagAttributes() Renders the HTML tag attributes. 646 resetButton() Generates a reset button tag. 647 resetInput() Generates a reset input button. 648 script() Generates a script tag. 649 style() Generates a style tag. 650 submitButton() Generates a submit button tag. 651 submitInput() Generates a submit input button. */ 652 //Generates a complete HTML tag. 653 654 //string toString(string[string] kvOptions) { 655 // string[] options; 656 // foreach(k, v; kvOptions) options ~= "%s=\"%s\"".format(k, v); 657 // return options.join(" "); } 658 //string toString(string[] vOptions) { return vOptions.join(" "); } 659 // 660 //string dtag(string name, string content = null, string[string] kvOptions = null, string[] vOptions = null) { 661 // if (!name) { return content; } 662 // 663 // string kv; if (kvOptions) kv = " "~kvOptions.toString; 664 // string v; if (vOptions) v = " "~vOptions.toString; 665 // 666 // return "<"~name~kv~v~">"~content~"</"~name~">"; 667 //} 668 /* textInput() Generates a text input field. 669 textarea() Generates a text area input. 670 ul() Generates an unordered list. 671 Protected Methods 672 Hide inherited methods 673 674 Method Description Defined By 675 activeBooleanInput() Generates a boolean input This method is mainly called by activeCheckbox() and activeRadio(). 676 activeListInput() Generates a list of input fields. 677 booleanInput() Generates a boolean input. 678 Property Details 679 $attributeOrder public static property 680 The preferred order of attributes in a tag. This mainly affects the order of the attributes that are rendered by renderTagAttributes(). 681 public static array $attributeOrder = ['type', 'id', 'class', 'name', 'value', 'href', 'src', 'action', 'method', 'selected', 'checked', 'readonly', 'disabled', 'multiple', 'size', 'maxlength', 'width', 'height', 'rows', 'cols', 'alt', 'title', 'rel', 'media'] 682 $dataAttributes public static property (available since version 2.0.3) 683 List of tag attributes that should be specially handled when their values are of array type. In particular, if the value of the data attribute is ['name' => 'xyz', 'age' => 13], two attributes will be generated instead of one: data-name="xyz" data-age="13". 684 public static array $dataAttributes = ['data', 'data-ng', 'ng'] 685 $voidElements public static property 686 List of void elements (element name => 1) 687 688 See also http://www.w3.org/TR/html-markup/syntax.html#void-element. 689 public static array $voidElements = ['area' => 1, 'base' => 1, 'br' => 1, 'col' => 1, 'command' => 1, 'embed' => 1, 'hr' => 1, 'img' => 1, 'input' => 1, 'keygen' => 1, 'link' => 1, 'meta' => 1, 'param' => 1, 'source' => 1, 'track' => 1, 'wbr' => 1] 690 Method Details 691 a() public static method 692 Generates a hyperlink tag. 693 694 See also yii\helpers\Url::to(). 695 public static string a ( $text, $url = null, $options = [] ) 696 $text string 697 Link body. It will NOT be HTML-encoded. Therefore you can pass in HTML code such as an image tag. If this is coming from end users, you should consider encode() it to prevent XSS attacks. 698 $url array|string|null 699 The URL for the hyperlink tag. This parameter will be processed by yii\helpers\Url::to() and will be used for the "href" attribute of the tag. If this parameter is null, the "href" attribute will not be generated. 700 If you want to use an absolute url you can call yii\helpers\Url::to() yourself, before passing the URL to this method, like this: 701 Html::a('link text', Url::to($url, true)) 702 $options array 703 The tag options in terms of name-value pairs. These will be rendered as the attributes of the resulting tag. The values will be HTML-encoded using encode(). If a value is null, the corresponding attribute will not be rendered. See renderTagAttributes() for details on how attributes are being rendered. 704 return string 705 The generated hyperlink 706 activeBooleanInput() protected static method (available since version 2.0.9) 707 Generates a boolean input This method is mainly called by activeCheckbox() and activeRadio(). 708 protected static string activeBooleanInput ( $type, $model, $attribute, $options = [] ) 709 $type string 710 The input type. This can be either radio or checkbox. 711 $model yii\base\Model 712 The model object 713 $attribute string 714 The attribute name or expression. See getAttributeName() for the format about attribute expression. 715 $options array 716 The tag options in terms of name-value pairs. See booleanInput() for details about accepted attributes. 717 return string 718 The generated input element 719 activeCheckbox() public static method 720 Generates a checkbox tag together with a label for the given model attribute. 721 722 This method will generate the "checked" tag attribute according to the model attribute value. 723 public static string activeCheckbox ( $model, $attribute, $options = [] ) 724 $model yii\base\Model 725 The model object 726 $attribute string 727 The attribute name or expression. See getAttributeName() for the format about attribute expression. 728 $options array 729 The tag options in terms of name-value pairs. See booleanInput() for details about accepted attributes. 730 return string 731 The generated checkbox tag 732 activeCheckboxList() public static method 733 Generates a list of checkboxes. 734 735 A checkbox list allows multiple selection, like listBox(). As a result, the corresponding submitted value is an array. The selection of the checkbox list is taken from the value of the model attribute. 736 public static string activeCheckboxList ( $model, $attribute, $items, $options = [] ) 737 $model yii\base\Model 738 The model object 739 $attribute string 740 The attribute name or expression. See getAttributeName() for the format about attribute expression. 741 $items array 742 The data item used to generate the checkboxes. The array keys are the checkbox values, and the array values are the corresponding labels. Note that the labels will NOT be HTML-encoded, while the values will. 743 $options array 744 Options (name => config) for the checkbox list container tag. The following options are specially handled: 745 tag: string|false, the tag name of the container element. False to render checkbox without container. See also tag(). 746 unselect: string, the value that should be submitted when none of the checkboxes is selected. You may set this option to be null to prevent default value submission. If this option is not set, an empty string will be submitted. 747 encode: boolean, whether to HTML-encode the checkbox labels. Defaults to true. This option is ignored if item option is set. 748 separator: string, the HTML code that separates items. 749 itemOptions: array, the options for generating the checkbox tag using checkbox(). 750 item: callable, a callback that can be used to customize the generation of the HTML code corresponding to a single item in $items. The signature of this callback must be: 751 function ($index, $label, $name, $checked, $value) 752 where $index is the zero-based index of the checkbox in the whole list; $label is the label for the checkbox; and $name, $value and $checked represent the name, value and the checked status of the checkbox input. 753 See renderTagAttributes() for details on how attributes are being rendered. 754 return string 755 The generated checkbox list 756 activeDropDownList() public static method 757 Generates a drop-down list for the given model attribute. 758 759 The selection of the drop-down list is taken from the value of the model attribute. 760 public static string activeDropDownList ( $model, $attribute, $items, $options = [] ) 761 $model yii\base\Model 762 The model object 763 $attribute string 764 The attribute name or expression. See getAttributeName() for the format about attribute expression. 765 $items array 766 The option data items. The array keys are option values, and the array values are the corresponding option labels. The array can also be nested (i.e. some array values are arrays too). For each sub-array, an option group will be generated whose label is the key associated with the sub-array. If you have a list of data models, you may convert them into the format described above using yii\helpers\ArrayHelper::map(). 767 Note, the values and labels will be automatically HTML-encoded by this method, and the blank spaces in the labels will also be HTML-encoded. 768 $options array 769 The tag options in terms of name-value pairs. The following options are specially handled: 770 prompt: string, a prompt text to be displayed as the first option. Since version 2.0.11 you can use an array to override the value and to set other tag attributes: 771 ['text' => 'Please select', 'options' => ['value' => 'none', 'class' => 'prompt', 'label' => 'Select']], 772 options: array, the attributes for the select option tags. The array keys must be valid option values, and the array values are the extra attributes for the corresponding option tags. For example, 773 [ 774 'value1' => ['disabled' => true], 775 'value2' => ['label' => 'value 2'], 776 ]; 777 groups: array, the attributes for the optgroup tags. The structure of this is similar to that of 'options', except that the array keys represent the optgroup labels specified in $items. 778 encodeSpaces: bool, whether to encode spaces in option prompt and option value with character. Defaults to false. 779 encode: bool, whether to encode option prompt and option value characters. Defaults to true. This option is available since 2.0.3. 780 The rest of the options will be rendered as the attributes of the resulting tag. The values will be HTML-encoded using encode(). If a value is null, the corresponding attribute will not be rendered. See renderTagAttributes() for details on how attributes are being rendered. 781 return string 782 The generated drop-down list tag 783 activeFileInput() public static method 784 Generates a file input tag for the given model attribute. 785 786 This method will generate the "name" and "value" tag attributes automatically for the model attribute unless they are explicitly specified in $options. 787 public static string activeFileInput ( $model, $attribute, $options = [] ) 788 $model yii\base\Model 789 The model object 790 $attribute string 791 The attribute name or expression. See getAttributeName() for the format about attribute expression. 792 $options array 793 The tag options in terms of name-value pairs. These will be rendered as the attributes of the resulting tag. The values will be HTML-encoded using encode(). See renderTagAttributes() for details on how attributes are being rendered. 794 return string 795 The generated input tag 796 activeHiddenInput() public static method 797 Generates a hidden input tag for the given model attribute. 798 799 This method will generate the "name" and "value" tag attributes automatically for the model attribute unless they are explicitly specified in $options. 800 public static string activeHiddenInput ( $model, $attribute, $options = [] ) 801 $model yii\base\Model 802 The model object 803 $attribute string 804 The attribute name or expression. See getAttributeName() for the format about attribute expression. 805 $options array 806 The tag options in terms of name-value pairs. These will be rendered as the attributes of the resulting tag. The values will be HTML-encoded using encode(). See renderTagAttributes() for details on how attributes are being rendered. 807 return string 808 The generated input tag 809 activeHint() public static method (available since version 2.0.4) 810 Generates a hint tag for the given model attribute. 811 812 The hint text is the hint associated with the attribute, obtained via yii\base\Model::getAttributeHint(). If no hint content can be obtained, method will return an empty string. 813 public static string activeHint ( $model, $attribute, $options = [] ) 814 $model yii\base\Model 815 The model object 816 $attribute string 817 The attribute name or expression. See getAttributeName() for the format about attribute expression. 818 $options array 819 The tag options in terms of name-value pairs. These will be rendered as the attributes of the resulting tag. The values will be HTML-encoded using encode(). If a value is null, the corresponding attribute will not be rendered. The following options are specially handled: 820 hint: this specifies the hint to be displayed. Note that this will NOT be encoded. If this is not set, yii\base\Model::getAttributeHint() will be called to get the hint for display (without encoding). 821 See renderTagAttributes() for details on how attributes are being rendered. 822 return string 823 The generated hint tag 824 activeInput() public static method 825 Generates an input tag for the given model attribute. 826 827 This method will generate the "name" and "value" tag attributes automatically for the model attribute unless they are explicitly specified in $options. 828 public static string activeInput ( $type, $model, $attribute, $options = [] ) 829 $type string 830 The input type (e.g. 'text', 'password') 831 $model yii\base\Model 832 The model object 833 $attribute string 834 The attribute name or expression. See getAttributeName() for the format about attribute expression. 835 $options array 836 The tag options in terms of name-value pairs. These will be rendered as the attributes of the resulting tag. The values will be HTML-encoded using encode(). See renderTagAttributes() for details on how attributes are being rendered. 837 return string 838 The generated input tag 839 activeLabel() public static method 840 Generates a label tag for the given model attribute. 841 842 The label text is the label associated with the attribute, obtained via yii\base\Model::getAttributeLabel(). 843 public static string activeLabel ( $model, $attribute, $options = [] ) 844 $model yii\base\Model 845 The model object 846 $attribute string 847 The attribute name or expression. See getAttributeName() for the format about attribute expression. 848 $options array 849 The tag options in terms of name-value pairs. These will be rendered as the attributes of the resulting tag. The values will be HTML-encoded using encode(). If a value is null, the corresponding attribute will not be rendered. The following options are specially handled: 850 label: this specifies the label to be displayed. Note that this will NOT be encoded. If this is not set, yii\base\Model::getAttributeLabel() will be called to get the label for display (after encoding). 851 See renderTagAttributes() for details on how attributes are being rendered. 852 return string 853 The generated label tag 854 activeListBox() public static method 855 Generates a list box. 856 857 The selection of the list box is taken from the value of the model attribute. 858 public static string activeListBox ( $model, $attribute, $items, $options = [] ) 859 $model yii\base\Model 860 The model object 861 $attribute string 862 The attribute name or expression. See getAttributeName() for the format about attribute expression. 863 $items array 864 The option data items. The array keys are option values, and the array values are the corresponding option labels. The array can also be nested (i.e. some array values are arrays too). For each sub-array, an option group will be generated whose label is the key associated with the sub-array. If you have a list of data models, you may convert them into the format described above using yii\helpers\ArrayHelper::map(). 865 Note, the values and labels will be automatically HTML-encoded by this method, and the blank spaces in the labels will also be HTML-encoded. 866 $options array 867 The tag options in terms of name-value pairs. The following options are specially handled: 868 prompt: string, a prompt text to be displayed as the first option. Since version 2.0.11 you can use an array to override the value and to set other tag attributes: 869 ['text' => 'Please select', 'options' => ['value' => 'none', 'class' => 'prompt', 'label' => 'Select']], 870 options: array, the attributes for the select option tags. The array keys must be valid option values, and the array values are the extra attributes for the corresponding option tags. For example, 871 [ 872 'value1' => ['disabled' => true], 873 'value2' => ['label' => 'value 2'], 874 ]; 875 groups: array, the attributes for the optgroup tags. The structure of this is similar to that of 'options', except that the array keys represent the optgroup labels specified in $items. 876 unselect: string, the value that will be submitted when no option is selected. When this attribute is set, a hidden field will be generated so that if no option is selected in multiple mode, we can still obtain the posted unselect value. 877 encodeSpaces: bool, whether to encode spaces in option prompt and option value with character. Defaults to false. 878 encode: bool, whether to encode option prompt and option value characters. Defaults to true. This option is available since 2.0.3. 879 The rest of the options will be rendered as the attributes of the resulting tag. The values will be HTML-encoded using encode(). If a value is null, the corresponding attribute will not be rendered. See renderTagAttributes() for details on how attributes are being rendered. 880 return string 881 The generated list box tag 882 activeListInput() protected static method 883 Generates a list of input fields. 884 885 This method is mainly called by activeListBox(), activeRadioList() and activeCheckboxList(). 886 protected static string activeListInput ( $type, $model, $attribute, $items, $options = [] ) 887 $type string 888 The input type. This can be 'listBox', 'radioList', or 'checkBoxList'. 889 $model yii\base\Model 890 The model object 891 $attribute string 892 The attribute name or expression. See getAttributeName() for the format about attribute expression. 893 $items array 894 The data item used to generate the input fields. The array keys are the input values, and the array values are the corresponding labels. Note that the labels will NOT be HTML-encoded, while the values will. 895 $options array 896 Options (name => config) for the input list. The supported special options depend on the input type specified by $type. 897 return string 898 The generated input list 899 activePasswordInput() public static method 900 Generates a password input tag for the given model attribute. 901 902 This method will generate the "name" and "value" tag attributes automatically for the model attribute unless they are explicitly specified in $options. 903 public static string activePasswordInput ( $model, $attribute, $options = [] ) 904 $model yii\base\Model 905 The model object 906 $attribute string 907 The attribute name or expression. See getAttributeName() for the format about attribute expression. 908 $options array 909 The tag options in terms of name-value pairs. These will be rendered as the attributes of the resulting tag. The values will be HTML-encoded using encode(). See renderTagAttributes() for details on how attributes are being rendered. The following special options are recognized: 910 maxlength: integer|boolean, when maxlength is set true and the model attribute is validated by a string validator, the maxlength option will take the value of yii\validators\StringValidator::$max. This option is available since version 2.0.6. 911 return string 912 The generated input tag 913 activeRadio() public static method 914 Generates a radio button tag together with a label for the given model attribute. 915 916 This method will generate the "checked" tag attribute according to the model attribute value. 917 public static string activeRadio ( $model, $attribute, $options = [] ) 918 $model yii\base\Model 919 The model object 920 $attribute string 921 The attribute name or expression. See getAttributeName() for the format about attribute expression. 922 $options array 923 The tag options in terms of name-value pairs. See booleanInput() for details about accepted attributes. 924 return string 925 The generated radio button tag 926 activeRadioList() public static method 927 Generates a list of radio buttons. 928 929 A radio button list is like a checkbox list, except that it only allows single selection. The selection of the radio buttons is taken from the value of the model attribute. 930 public static string activeRadioList ( $model, $attribute, $items, $options = [] ) 931 $model yii\base\Model 932 The model object 933 $attribute string 934 The attribute name or expression. See getAttributeName() for the format about attribute expression. 935 $items array 936 The data item used to generate the radio buttons. The array keys are the radio values, and the array values are the corresponding labels. Note that the labels will NOT be HTML-encoded, while the values will. 937 $options array 938 Options (name => config) for the radio button list container tag. The following options are specially handled: 939 tag: string|false, the tag name of the container element. False to render radio button without container. See also tag(). 940 unselect: string, the value that should be submitted when none of the radio buttons is selected. You may set this option to be null to prevent default value submission. If this option is not set, an empty string will be submitted. 941 encode: boolean, whether to HTML-encode the checkbox labels. Defaults to true. This option is ignored if item option is set. 942 separator: string, the HTML code that separates items. 943 itemOptions: array, the options for generating the radio button tag using radio(). 944 item: callable, a callback that can be used to customize the generation of the HTML code corresponding to a single item in $items. The signature of this callback must be: 945 function ($index, $label, $name, $checked, $value) 946 where $index is the zero-based index of the radio button in the whole list; $label is the label for the radio button; and $name, $value and $checked represent the name, value and the checked status of the radio button input. 947 See renderTagAttributes() for details on how attributes are being rendered. 948 return string 949 The generated radio button list 950 activeTextInput() public static method 951 Generates a text input tag for the given model attribute. 952 953 This method will generate the "name" and "value" tag attributes automatically for the model attribute unless they are explicitly specified in $options. 954 public static string activeTextInput ( $model, $attribute, $options = [] ) 955 $model yii\base\Model 956 The model object 957 $attribute string 958 The attribute name or expression. See getAttributeName() for the format about attribute expression. 959 $options array 960 The tag options in terms of name-value pairs. These will be rendered as the attributes of the resulting tag. The values will be HTML-encoded using encode(). See renderTagAttributes() for details on how attributes are being rendered. The following special options are recognized: 961 maxlength: integer|boolean, when maxlength is set true and the model attribute is validated by a string validator, the maxlength option will take the value of yii\validators\StringValidator::$max. This is available since version 2.0.3. 962 return string 963 The generated input tag 964 activeTextarea() public static method 965 Generates a textarea tag for the given model attribute. 966 967 The model attribute value will be used as the content in the textarea. 968 public static string activeTextarea ( $model, $attribute, $options = [] ) 969 $model yii\base\Model 970 The model object 971 $attribute string 972 The attribute name or expression. See getAttributeName() for the format about attribute expression. 973 $options array 974 The tag options in terms of name-value pairs. These will be rendered as the attributes of the resulting tag. The values will be HTML-encoded using encode(). See renderTagAttributes() for details on how attributes are being rendered. The following special options are recognized: 975 maxlength: integer|boolean, when maxlength is set true and the model attribute is validated by a string validator, the maxlength option will take the value of yii\validators\StringValidator::$max. This option is available since version 2.0.6. 976 return string 977 The generated textarea tag 978 addCssClass() public static method 979 Adds a CSS class (or several classes) to the specified options. 980 981 If the CSS class is already in the options, it will not be added again. If class specification at given options is an array, and some class placed there with the named (string) key, overriding of such key will have no effect. For example: 982 983 $options = ['class' => ['persistent' => 'initial']]; 984 Html::addCssClass($options, ['persistent' => 'override']); 985 var_dump($options['class']); // outputs: array('persistent' => 'initial'); 986 public static void addCssClass ( &$options, $class ) 987 $options array 988 The options to be modified. 989 $class string|array 990 The CSS class(es) to be added 991 addCssStyle() public static method 992 Adds the specified CSS style to the HTML options. 993 994 If the options already contain a style element, the new style will be merged with the existing one. If a CSS property exists in both the new and the old styles, the old one may be overwritten if $overwrite is true. 995 996 For example, 997 998 Html::addCssStyle($options, 'width: 100px; height: 200px'); 999 See also: 1000 1001 removeCssStyle() 1002 cssStyleFromArray() 1003 cssStyleToArray() 1004 public static void addCssStyle ( &$options, $style, $overwrite = true ) 1005 $options array 1006 The HTML options to be modified. 1007 $style string|array 1008 The new style string (e.g. 'width: 100px; height: 200px') or array (e.g. ['width' => '100px', 'height' => '200px']). 1009 $overwrite boolean 1010 Whether to overwrite existing CSS properties if the new style contain them too. 1011 beginForm() public static method 1012 Generates a form start tag. 1013 1014 See also endForm(). 1015 public static string beginForm ( $action = '', $method = 'post', $options = [] ) 1016 $action array|string 1017 The form action URL. This parameter will be processed by yii\helpers\Url::to(). 1018 $method string 1019 The form submission method, such as "post", "get", "put", "delete" (case-insensitive). Since most browsers only support "post" and "get", if other methods are given, they will be simulated using "post", and a hidden input will be added which contains the actual method type. See yii\web\Request::$methodParam for more details. 1020 $options array 1021 The tag options in terms of name-value pairs. These will be rendered as the attributes of the resulting tag. The values will be HTML-encoded using encode(). If a value is null, the corresponding attribute will not be rendered. See renderTagAttributes() for details on how attributes are being rendered. 1022 Special options: 1023 csrf: whether to generate the CSRF hidden input. Defaults to true. 1024 return string 1025 The generated form start tag. 1026 beginTag() public static method 1027 Generates a start tag. 1028 1029 See also: 1030 1031 endTag() 1032 tag() 1033 public static string beginTag ( $name, $options = [] ) 1034 $name string|boolean|null 1035 The tag name. If $name is null or false, the corresponding content will be rendered without any tag. 1036 $options array 1037 The tag options in terms of name-value pairs. These will be rendered as the attributes of the resulting tag. The values will be HTML-encoded using encode(). If a value is null, the corresponding attribute will not be rendered. See renderTagAttributes() for details on how attributes are being rendered. 1038 return string 1039 The generated start tag 1040 booleanInput() protected static method (available since version 2.0.9) 1041 Generates a boolean input. 1042 protected static string booleanInput ( $type, $name, $checked = false, $options = [] ) 1043 $type string 1044 The input type. This can be either radio or checkbox. 1045 $name string 1046 The name attribute. 1047 $checked boolean 1048 Whether the checkbox should be checked. 1049 $options array 1050 The tag options in terms of name-value pairs. The following options are specially handled: 1051 uncheck: string, the value associated with the uncheck state of the checkbox. When this attribute is present, a hidden input will be generated so that if the checkbox is not checked and is submitted, the value of this attribute will still be submitted to the server via the hidden input. 1052 label: string, a label displayed next to the checkbox. It will NOT be HTML-encoded. Therefore you can pass in HTML code such as an image tag. If this is is coming from end users, you should encode() it to prevent XSS attacks. When this option is specified, the checkbox will be enclosed by a label tag. 1053 labelOptions: array, the HTML attributes for the label tag. Do not set this option unless you set the "label" option. 1054 The rest of the options will be rendered as the attributes of the resulting checkbox tag. The values will be HTML-encoded using encode(). If a value is null, the corresponding attribute will not be rendered. See renderTagAttributes() for details on how attributes are being rendered. 1055 return string 1056 The generated checkbox tag 1057 button() public static method 1058 Generates a button tag. 1059 public static string button ( $content = 'Button', $options = [] ) 1060 $content string 1061 The content enclosed within the button tag. It will NOT be HTML-encoded. Therefore you can pass in HTML code such as an image tag. If this is is coming from end users, you should consider encode() it to prevent XSS attacks. 1062 $options array 1063 The tag options in terms of name-value pairs. These will be rendered as the attributes of the resulting tag. The values will be HTML-encoded using encode(). If a value is null, the corresponding attribute will not be rendered. See renderTagAttributes() for details on how attributes are being rendered. 1064 return string 1065 The generated button tag 1066 buttonInput() public static method 1067 Generates an input button. 1068 public static string buttonInput ( $label = 'Button', $options = [] ) 1069 $label string 1070 The value attribute. If it is null, the value attribute will not be generated. 1071 $options array 1072 The tag options in terms of name-value pairs. These will be rendered as the attributes of the resulting tag. The values will be HTML-encoded using encode(). If a value is null, the corresponding attribute will not be rendered. See renderTagAttributes() for details on how attributes are being rendered. 1073 return string 1074 The generated button tag 1075 checkbox() public static method 1076 Generates a checkbox input. 1077 public static string checkbox ( $name, $checked = false, $options = [] ) 1078 $name string 1079 The name attribute. 1080 $checked boolean 1081 Whether the checkbox should be checked. 1082 $options array 1083 The tag options in terms of name-value pairs. See booleanInput() for details about accepted attributes. 1084 return string 1085 The generated checkbox tag 1086 checkboxList() public static method 1087 Generates a list of checkboxes. 1088 1089 A checkbox list allows multiple selection, like listBox(). As a result, the corresponding submitted value is an array. 1090 public static string checkboxList ( $name, $selection = null, $items = [], $options = [] ) 1091 $name string 1092 The name attribute of each checkbox. 1093 $selection string|array|null 1094 The selected value(s). String for single or array for multiple selection(s). 1095 $items array 1096 The data item used to generate the checkboxes. The array keys are the checkbox values, while the array values are the corresponding labels. 1097 $options array 1098 Options (name => config) for the checkbox list container tag. The following options are specially handled: 1099 tag: string|false, the tag name of the container element. False to render checkbox without container. See also tag(). 1100 unselect: string, the value that should be submitted when none of the checkboxes is selected. By setting this option, a hidden input will be generated. 1101 encode: boolean, whether to HTML-encode the checkbox labels. Defaults to true. This option is ignored if item option is set. 1102 separator: string, the HTML code that separates items. 1103 itemOptions: array, the options for generating the checkbox tag using checkbox(). 1104 item: callable, a callback that can be used to customize the generation of the HTML code corresponding to a single item in $items. The signature of this callback must be: 1105 function ($index, $label, $name, $checked, $value) 1106 where $index is the zero-based index of the checkbox in the whole list; $label is the label for the checkbox; and $name, $value and $checked represent the name, value and the checked status of the checkbox input, respectively. 1107 See renderTagAttributes() for details on how attributes are being rendered. 1108 return string 1109 The generated checkbox list 1110 csrfMetaTags() public static method 1111 Generates the meta tags containing CSRF token information. 1112 1113 See also yii\web\Request::$enableCsrfValidation. 1114 public static string csrfMetaTags ( ) 1115 return string 1116 The generated meta tags 1117 cssFile() public static method 1118 Generates a link tag that refers to an external CSS file. 1119 1120 See also yii\helpers\Url::to(). 1121 public static string cssFile ( $url, $options = [] ) 1122 $url array|string 1123 The URL of the external CSS file. This parameter will be processed by yii\helpers\Url::to(). 1124 $options array 1125 The tag options in terms of name-value pairs. The following options are specially handled: 1126 condition: specifies the conditional comments for IE, e.g., lt IE 9. When this is specified, the generated link tag will be enclosed within the conditional comments. This is mainly useful for supporting old versions of IE browsers. 1127 noscript: if set to true, link tag will be wrapped into <noscript> tags. 1128 The rest of the options will be rendered as the attributes of the resulting link tag. The values will be HTML-encoded using encode(). If a value is null, the corresponding attribute will not be rendered. See renderTagAttributes() for details on how attributes are being rendered. 1129 return string 1130 The generated link tag 1131 cssStyleFromArray() public static method 1132 Converts a CSS style array into a string representation. 1133 1134 For example, 1135 1136 print_r(Html::cssStyleFromArray(['width' => '100px', 'height' => '200px'])); 1137 // will display: 'width: 100px; height: 200px;' 1138 public static string cssStyleFromArray ( array $style ) 1139 $style array 1140 The CSS style array. The array keys are the CSS property names, and the array values are the corresponding CSS property values. 1141 return string 1142 The CSS style string. If the CSS style is empty, a null will be returned. 1143 cssStyleToArray() public static method 1144 Converts a CSS style string into an array representation. 1145 1146 The array keys are the CSS property names, and the array values are the corresponding CSS property values. 1147 1148 For example, 1149 1150 print_r(Html::cssStyleToArray('width: 100px; height: 200px;')); 1151 // will display: ['width' => '100px', 'height' => '200px'] 1152 public static array cssStyleToArray ( $style ) 1153 $style string 1154 The CSS style string 1155 return array 1156 The array representation of the CSS style 1157 decode() public static method 1158 Decodes special HTML entities back to the corresponding characters. 1159 1160 This is the opposite of encode(). 1161 1162 See also: 1163 1164 encode() 1165 http://www.php.net/manual/en/function.htmlspecialchars-decode.php 1166 public static string decode ( $content ) 1167 $content string 1168 The content to be decoded 1169 return string 1170 The decoded content 1171 dropDownList() public static method 1172 Generates a drop-down list. 1173 public static string dropDownList ( $name, $selection = null, $items = [], $options = [] ) 1174 $name string 1175 The input name 1176 $selection string|array|null 1177 The selected value(s). String for single or array for multiple selection(s). 1178 $items array 1179 The option data items. The array keys are option values, and the array values are the corresponding option labels. The array can also be nested (i.e. some array values are arrays too). For each sub-array, an option group will be generated whose label is the key associated with the sub-array. If you have a list of data models, you may convert them into the format described above using yii\helpers\ArrayHelper::map(). 1180 Note, the values and labels will be automatically HTML-encoded by this method, and the blank spaces in the labels will also be HTML-encoded. 1181 $options array 1182 The tag options in terms of name-value pairs. The following options are specially handled: 1183 prompt: string, a prompt text to be displayed as the first option. Since version 2.0.11 you can use an array to override the value and to set other tag attributes: 1184 ['text' => 'Please select', 'options' => ['value' => 'none', 'class' => 'prompt', 'label' => 'Select']], 1185 options: array, the attributes for the select option tags. The array keys must be valid option values, and the array values are the extra attributes for the corresponding option tags. For example, 1186 [ 1187 'value1' => ['disabled' => true], 1188 'value2' => ['label' => 'value 2'], 1189 ]; 1190 groups: array, the attributes for the optgroup tags. The structure of this is similar to that of 'options', except that the array keys represent the optgroup labels specified in $items. 1191 encodeSpaces: bool, whether to encode spaces in option prompt and option value with character. Defaults to false. 1192 encode: bool, whether to encode option prompt and option value characters. Defaults to true. This option is available since 2.0.3. 1193 The rest of the options will be rendered as the attributes of the resulting tag. The values will be HTML-encoded using encode(). If a value is null, the corresponding attribute will not be rendered. See renderTagAttributes() for details on how attributes are being rendered. 1194 return string 1195 The generated drop-down list tag 1196 encode() public static method 1197 Encodes special characters into HTML entities. 1198 1199 The application charset will be used for encoding. 1200 1201 See also: 1202 1203 decode() 1204 http://www.php.net/manual/en/function.htmlspecialchars.php 1205 public static string encode ( $content, $doubleEncode = true ) 1206 $content string 1207 The content to be encoded 1208 $doubleEncode boolean 1209 Whether to encode HTML entities in $content. If false, HTML entities in $content will not be further encoded. 1210 return string 1211 The encoded content 1212 endForm() public static method 1213 Generates a form end tag. 1214 1215 See also beginForm(). 1216 public static string endForm ( ) 1217 return string 1218 The generated tag 1219 endTag() public static method 1220 Generates an end tag. 1221 1222 See also: 1223 1224 beginTag() 1225 tag() 1226 public static string endTag ( $name ) 1227 $name string|boolean|null 1228 The tag name. If $name is null or false, the corresponding content will be rendered without any tag. 1229 return string 1230 The generated end tag 1231 error() public static method 1232 Generates a tag that contains the first validation error of the specified model attribute. 1233 1234 Note that even if there is no validation error, this method will still return an empty error tag. 1235 public static string error ( $model, $attribute, $options = [] ) 1236 $model yii\base\Model 1237 The model object 1238 $attribute string 1239 The attribute name or expression. See getAttributeName() for the format about attribute expression. 1240 $options array 1241 The tag options in terms of name-value pairs. The values will be HTML-encoded using encode(). If a value is null, the corresponding attribute will not be rendered. 1242 The following options are specially handled: 1243 tag: this specifies the tag name. If not set, "div" will be used. See also tag(). 1244 encode: boolean, if set to false then the error message won't be encoded. 1245 See renderTagAttributes() for details on how attributes are being rendered. 1246 return string 1247 The generated label tag 1248 errorSummary() public static method 1249 Generates a summary of the validation errors. 1250 1251 If there is no validation error, an empty error summary markup will still be generated, but it will be hidden. 1252 public static string errorSummary ( $models, $options = [] ) 1253 $models yii\base\Model|yii\base\Model[] 1254 The model(s) whose validation errors are to be displayed. 1255 $options array 1256 The tag options in terms of name-value pairs. The following options are specially handled: 1257 header: string, the header HTML for the error summary. If not set, a default prompt string will be used. 1258 footer: string, the footer HTML for the error summary. Defaults to empty string. 1259 encode: boolean, if set to false then the error messages won't be encoded. Defaults to true. 1260 showAllErrors: boolean, if set to true every error message for each attribute will be shown otherwise only the first error message for each attribute will be shown. Defaults to false. Option is available since 2.0.10. 1261 The rest of the options will be rendered as the attributes of the container tag. 1262 return string 1263 The generated error summary 1264 escapeJsRegularExpression() public static method (available since version 2.0.6) 1265 Escapes regular expression to use in JavaScript 1266 public static string escapeJsRegularExpression ( $regexp ) 1267 $regexp string 1268 The regular expression to be escaped. 1269 return string 1270 The escaped result. 1271 fileInput() public static method 1272 Generates a file input field. 1273 1274 To use a file input field, you should set the enclosing form's "enctype" attribute to be "multipart/form-data". After the form is submitted, the uploaded file information can be obtained via $_FILES[$name] (see PHP documentation). 1275 public static string fileInput ( $name, $value = null, $options = [] ) 1276 $name string 1277 The name attribute. 1278 $value string 1279 The value attribute. If it is null, the value attribute will not be generated. 1280 $options array 1281 The tag options in terms of name-value pairs. These will be rendered as the attributes of the resulting tag. The values will be HTML-encoded using encode(). If a value is null, the corresponding attribute will not be rendered. See renderTagAttributes() for details on how attributes are being rendered. 1282 return string 1283 The generated file input tag 1284 getAttributeName() public static method 1285 Returns the real attribute name from the given attribute expression. 1286 1287 An attribute expression is an attribute name prefixed and/or suffixed with array indexes. It is mainly used in tabular data input and/or input of array type. Below are some examples: 1288 1289 [0]content is used in tabular data input to represent the "content" attribute for the first model in tabular input; 1290 dates[0] represents the first array element of the "dates" attribute; 1291 [0]dates[0] represents the first array element of the "dates" attribute for the first model in tabular input. 1292 If $attribute has neither prefix nor suffix, it will be returned back without change. 1293 public static string getAttributeName ( $attribute ) 1294 $attribute string 1295 The attribute name or expression 1296 return string 1297 The attribute name without prefix and suffix. 1298 throws yii\base\InvalidParamException 1299 if the attribute name contains non-word characters. 1300 getAttributeValue() public static method 1301 Returns the value of the specified attribute name or expression. 1302 1303 For an attribute expression like [0]dates[0], this method will return the value of $model->dates[0]. See getAttributeName() for more details about attribute expression. 1304 1305 If an attribute value is an instance of yii\db\ActiveRecordInterface or an array of such instances, the primary value(s) of the AR instance(s) will be returned instead. 1306 public static string|array getAttributeValue ( $model, $attribute ) 1307 $model yii\base\Model 1308 The model object 1309 $attribute string 1310 The attribute name or expression 1311 return string|array 1312 The corresponding attribute value 1313 throws yii\base\InvalidParamException 1314 if the attribute name contains non-word characters. 1315 getInputId() public static method 1316 Generates an appropriate input ID for the specified attribute name or expression. 1317 1318 This method converts the result getInputName() into a valid input ID. For example, if getInputName() returns Post[content], this method will return post-content. 1319 public static string getInputId ( $model, $attribute ) 1320 $model yii\base\Model 1321 The model object 1322 $attribute string 1323 The attribute name or expression. See getAttributeName() for explanation of attribute expression. 1324 return string 1325 The generated input ID 1326 throws yii\base\InvalidParamException 1327 if the attribute name contains non-word characters. 1328 getInputName() public static method 1329 Generates an appropriate input name for the specified attribute name or expression. 1330 1331 This method generates a name that can be used as the input name to collect user input for the specified attribute. The name is generated according to the form name of the model and the given attribute name. For example, if the form name of the Post model is Post, then the input name generated for the content attribute would be Post[content]. 1332 1333 See getAttributeName() for explanation of attribute expression. 1334 public static string getInputName ( $model, $attribute ) 1335 $model yii\base\Model 1336 The model object 1337 $attribute string 1338 The attribute name or expression 1339 return string 1340 The generated input name 1341 throws yii\base\InvalidParamException 1342 if the attribute name contains non-word characters. 1343 hiddenInput() public static method 1344 Generates a hidden input field. 1345 public static string hiddenInput ( $name, $value = null, $options = [] ) 1346 $name string 1347 The name attribute. 1348 $value string 1349 The value attribute. If it is null, the value attribute will not be generated. 1350 $options array 1351 The tag options in terms of name-value pairs. These will be rendered as the attributes of the resulting tag. The values will be HTML-encoded using encode(). If a value is null, the corresponding attribute will not be rendered. See renderTagAttributes() for details on how attributes are being rendered. 1352 return string 1353 The generated hidden input tag 1354 img() public static method 1355 Generates an image tag. 1356 public static string img ( $src, $options = [] ) 1357 $src array|string 1358 The image URL. This parameter will be processed by yii\helpers\Url::to(). 1359 $options array 1360 The tag options in terms of name-value pairs. These will be rendered as the attributes of the resulting tag. The values will be HTML-encoded using encode(). If a value is null, the corresponding attribute will not be rendered. See renderTagAttributes() for details on how attributes are being rendered. 1361 return string 1362 The generated image tag 1363 input() public static method 1364 Generates an input type of the given type. 1365 public static string input ( $type, $name = null, $value = null, $options = [] ) 1366 $type string 1367 The type attribute. 1368 $name string 1369 The name attribute. If it is null, the name attribute will not be generated. 1370 $value string 1371 The value attribute. If it is null, the value attribute will not be generated. 1372 $options array 1373 The tag options in terms of name-value pairs. These will be rendered as the attributes of the resulting tag. The values will be HTML-encoded using encode(). If a value is null, the corresponding attribute will not be rendered. See renderTagAttributes() for details on how attributes are being rendered. 1374 return string 1375 The generated input tag 1376 jsFile() public static method 1377 Generates a script tag that refers to an external JavaScript file. 1378 1379 See also yii\helpers\Url::to(). 1380 public static string jsFile ( $url, $options = [] ) 1381 $url string 1382 The URL of the external JavaScript file. This parameter will be processed by yii\helpers\Url::to(). 1383 $options array 1384 The tag options in terms of name-value pairs. The following option is specially handled: 1385 condition: specifies the conditional comments for IE, e.g., lt IE 9. When this is specified, the generated script tag will be enclosed within the conditional comments. This is mainly useful for supporting old versions of IE browsers. 1386 The rest of the options will be rendered as the attributes of the resulting script tag. The values will be HTML-encoded using encode(). If a value is null, the corresponding attribute will not be rendered. See renderTagAttributes() for details on how attributes are being rendered. 1387 return string 1388 The generated script tag 1389 label() public static method 1390 Generates a label tag. 1391 public static string label ( $content, $for = null, $options = [] ) 1392 $content string 1393 Label text. It will NOT be HTML-encoded. Therefore you can pass in HTML code such as an image tag. If this is is coming from end users, you should encode() it to prevent XSS attacks. 1394 $for string 1395 The ID of the HTML element that this label is associated with. If this is null, the "for" attribute will not be generated. 1396 $options array 1397 The tag options in terms of name-value pairs. These will be rendered as the attributes of the resulting tag. The values will be HTML-encoded using encode(). If a value is null, the corresponding attribute will not be rendered. See renderTagAttributes() for details on how attributes are being rendered. 1398 return string 1399 The generated label tag 1400 listBox() public static method 1401 Generates a list box. 1402 public static string listBox ( $name, $selection = null, $items = [], $options = [] ) 1403 $name string 1404 The input name 1405 $selection string|array|null 1406 The selected value(s). String for single or array for multiple selection(s). 1407 $items array 1408 The option data items. The array keys are option values, and the array values are the corresponding option labels. The array can also be nested (i.e. some array values are arrays too). For each sub-array, an option group will be generated whose label is the key associated with the sub-array. If you have a list of data models, you may convert them into the format described above using yii\helpers\ArrayHelper::map(). 1409 Note, the values and labels will be automatically HTML-encoded by this method, and the blank spaces in the labels will also be HTML-encoded. 1410 $options array 1411 The tag options in terms of name-value pairs. The following options are specially handled: 1412 prompt: string, a prompt text to be displayed as the first option. Since version 2.0.11 you can use an array to override the value and to set other tag attributes: 1413 ['text' => 'Please select', 'options' => ['value' => 'none', 'class' => 'prompt', 'label' => 'Select']], 1414 options: array, the attributes for the select option tags. The array keys must be valid option values, and the array values are the extra attributes for the corresponding option tags. For example, 1415 [ 1416 'value1' => ['disabled' => true], 1417 'value2' => ['label' => 'value 2'], 1418 ]; 1419 groups: array, the attributes for the optgroup tags. The structure of this is similar to that of 'options', except that the array keys represent the optgroup labels specified in $items. 1420 unselect: string, the value that will be submitted when no option is selected. When this attribute is set, a hidden field will be generated so that if no option is selected in multiple mode, we can still obtain the posted unselect value. 1421 encodeSpaces: bool, whether to encode spaces in option prompt and option value with character. Defaults to false. 1422 encode: bool, whether to encode option prompt and option value characters. Defaults to true. This option is available since 2.0.3. 1423 The rest of the options will be rendered as the attributes of the resulting tag. The values will be HTML-encoded using encode(). If a value is null, the corresponding attribute will not be rendered. See renderTagAttributes() for details on how attributes are being rendered. 1424 return string 1425 The generated list box tag 1426 mailto() public static method 1427 Generates a mailto hyperlink. 1428 public static string mailto ( $text, $email = null, $options = [] ) 1429 $text string 1430 Link body. It will NOT be HTML-encoded. Therefore you can pass in HTML code such as an image tag. If this is coming from end users, you should consider encode() it to prevent XSS attacks. 1431 $email string 1432 Email address. If this is null, the first parameter (link body) will be treated as the email address and used. 1433 $options array 1434 The tag options in terms of name-value pairs. These will be rendered as the attributes of the resulting tag. The values will be HTML-encoded using encode(). If a value is null, the corresponding attribute will not be rendered. See renderTagAttributes() for details on how attributes are being rendered. 1435 return string 1436 The generated mailto link 1437 ol() public static method 1438 Generates an ordered list. 1439 public static string ol ( $items, $options = [] ) 1440 $items array|Traversable 1441 The items for generating the list. Each item generates a single list item. Note that items will be automatically HTML encoded if $options['encode'] is not set or true. 1442 $options array 1443 Options (name => config) for the radio button list. The following options are supported: 1444 encode: boolean, whether to HTML-encode the items. Defaults to true. This option is ignored if the item option is specified. 1445 itemOptions: array, the HTML attributes for the li tags. This option is ignored if the item option is specified. 1446 item: callable, a callback that is used to generate each individual list item. The signature of this callback must be: 1447 function ($item, $index) 1448 where $index is the array key corresponding to $item in $items. The callback should return the whole list item tag. 1449 See renderTagAttributes() for details on how attributes are being rendered. 1450 return string 1451 The generated ordered list. An empty string is returned if $items is empty. 1452 passwordInput() public static method 1453 Generates a password input field. 1454 public static string passwordInput ( $name, $value = null, $options = [] ) 1455 $name string 1456 The name attribute. 1457 $value string 1458 The value attribute. If it is null, the value attribute will not be generated. 1459 $options array 1460 The tag options in terms of name-value pairs. These will be rendered as the attributes of the resulting tag. The values will be HTML-encoded using encode(). If a value is null, the corresponding attribute will not be rendered. See renderTagAttributes() for details on how attributes are being rendered. 1461 return string 1462 The generated password input tag 1463 radio() public static method 1464 Generates a radio button input. 1465 public static string radio ( $name, $checked = false, $options = [] ) 1466 $name string 1467 The name attribute. 1468 $checked boolean 1469 Whether the radio button should be checked. 1470 $options array 1471 The tag options in terms of name-value pairs. See booleanInput() for details about accepted attributes. 1472 return string 1473 The generated radio button tag 1474 radioList() public static method 1475 Generates a list of radio buttons. 1476 1477 A radio button list is like a checkbox list, except that it only allows single selection. 1478 public static string radioList ( $name, $selection = null, $items = [], $options = [] ) 1479 $name string 1480 The name attribute of each radio button. 1481 $selection string|array|null 1482 The selected value(s). String for single or array for multiple selection(s). 1483 $items array 1484 The data item used to generate the radio buttons. The array keys are the radio button values, while the array values are the corresponding labels. 1485 $options array 1486 Options (name => config) for the radio button list container tag. The following options are specially handled: 1487 tag: string|false, the tag name of the container element. False to render radio buttons without container. See also tag(). 1488 unselect: string, the value that should be submitted when none of the radio buttons is selected. By setting this option, a hidden input will be generated. 1489 encode: boolean, whether to HTML-encode the checkbox labels. Defaults to true. This option is ignored if item option is set. 1490 separator: string, the HTML code that separates items. 1491 itemOptions: array, the options for generating the radio button tag using radio(). 1492 item: callable, a callback that can be used to customize the generation of the HTML code corresponding to a single item in $items. The signature of this callback must be: 1493 function ($index, $label, $name, $checked, $value) 1494 where $index is the zero-based index of the radio button in the whole list; $label is the label for the radio button; and $name, $value and $checked represent the name, value and the checked status of the radio button input, respectively. 1495 See renderTagAttributes() for details on how attributes are being rendered. 1496 return string 1497 The generated radio button list 1498 removeCssClass() public static method 1499 Removes a CSS class from the specified options. 1500 public static void removeCssClass ( &$options, $class ) 1501 $options array 1502 The options to be modified. 1503 $class string|array 1504 The CSS class(es) to be removed 1505 removeCssStyle() public static method 1506 Removes the specified CSS style from the HTML options. 1507 1508 For example, 1509 1510 Html::removeCssStyle($options, ['width', 'height']); 1511 See also addCssStyle(). 1512 public static void removeCssStyle ( &$options, $properties ) 1513 $options array 1514 The HTML options to be modified. 1515 $properties string|array 1516 The CSS properties to be removed. You may use a string if you are removing a single property. 1517 renderSelectOptions() public static method 1518 Renders the option tags that can be used by dropDownList() and listBox(). 1519 public static string renderSelectOptions ( $selection, $items, &$tagOptions = [] ) 1520 $selection string|array|null 1521 The selected value(s). String for single or array for multiple selection(s). 1522 $items array 1523 The option data items. The array keys are option values, and the array values are the corresponding option labels. The array can also be nested (i.e. some array values are arrays too). For each sub-array, an option group will be generated whose label is the key associated with the sub-array. If you have a list of data models, you may convert them into the format described above using yii\helpers\ArrayHelper::map(). 1524 Note, the values and labels will be automatically HTML-encoded by this method, and the blank spaces in the labels will also be HTML-encoded. 1525 $tagOptions array 1526 The $options parameter that is passed to the dropDownList() or listBox() call. This method will take out these elements, if any: "prompt", "options" and "groups". See more details in dropDownList() for the explanation of these elements. 1527 return string 1528 The generated list options 1529 renderTagAttributes() public static method 1530 Renders the HTML tag attributes. 1531 1532 Attributes whose values are of boolean type will be treated as boolean attributes. 1533 1534 Attributes whose values are null will not be rendered. 1535 1536 The values of attributes will be HTML-encoded using encode(). 1537 1538 The "data" attribute is specially handled when it is receiving an array value. In this case, the array will be "expanded" and a list data attributes will be rendered. For example, if 'data' => ['id' => 1, 'name' => 'yii'], then this will be rendered: data-id="1" data-name="yii". Additionally 'data' => ['params' => ['id' => 1, 'name' => 'yii'], 'status' => 'ok'] will be rendered as: data-params='{"id":1,"name":"yii"}' data-status="ok". 1539 public static string renderTagAttributes ( $attributes ) 1540 $attributes array 1541 Attributes to be rendered. The attribute values will be HTML-encoded using encode(). 1542 return string 1543 The rendering result. If the attributes are not empty, they will be rendered into a string with a leading white space (so that it can be directly appended to the tag name in a tag. If there is no attribute, an empty string will be returned. 1544 resetButton() public static method 1545 Generates a reset button tag. 1546 public static string resetButton ( $content = 'Reset', $options = [] ) 1547 $content string 1548 The content enclosed within the button tag. It will NOT be HTML-encoded. Therefore you can pass in HTML code such as an image tag. If this is is coming from end users, you should consider encode() it to prevent XSS attacks. 1549 $options array 1550 The tag options in terms of name-value pairs. These will be rendered as the attributes of the resulting tag. The values will be HTML-encoded using encode(). If a value is null, the corresponding attribute will not be rendered. See renderTagAttributes() for details on how attributes are being rendered. 1551 return string 1552 The generated reset button tag 1553 resetInput() public static method 1554 Generates a reset input button. 1555 public static string resetInput ( $label = 'Reset', $options = [] ) 1556 $label string 1557 The value attribute. If it is null, the value attribute will not be generated. 1558 $options array 1559 The attributes of the button tag. The values will be HTML-encoded using encode(). Attributes whose value is null will be ignored and not put in the tag returned. See renderTagAttributes() for details on how attributes are being rendered. 1560 return string 1561 The generated button tag 1562 script() public static method 1563 Generates a script tag. 1564 public static string script ( $content, $options = [] ) 1565 $content string 1566 The script content 1567 $options array 1568 The tag options in terms of name-value pairs. These will be rendered as the attributes of the resulting tag. The values will be HTML-encoded using encode(). If a value is null, the corresponding attribute will not be rendered. See renderTagAttributes() for details on how attributes are being rendered. 1569 return string 1570 The generated script tag 1571 style() public static method 1572 Generates a style tag. 1573 public static string style ( $content, $options = [] ) 1574 $content string 1575 The style content 1576 $options array 1577 The tag options in terms of name-value pairs. These will be rendered as the attributes of the resulting tag. The values will be HTML-encoded using encode(). If a value is null, the corresponding attribute will not be rendered. See renderTagAttributes() for details on how attributes are being rendered. 1578 return string 1579 The generated style tag 1580 submitButton() public static method 1581 Generates a submit button tag. 1582 1583 Be careful when naming form elements such as submit buttons. According to the jQuery documentation there are some reserved names that can cause conflicts, e.g. submit, length, or method. 1584 public static string submitButton ( $content = 'Submit', $options = [] ) 1585 $content string 1586 The content enclosed within the button tag. It will NOT be HTML-encoded. Therefore you can pass in HTML code such as an image tag. If this is is coming from end users, you should consider encode() it to prevent XSS attacks. 1587 $options array 1588 The tag options in terms of name-value pairs. These will be rendered as the attributes of the resulting tag. The values will be HTML-encoded using encode(). If a value is null, the corresponding attribute will not be rendered. See renderTagAttributes() for details on how attributes are being rendered. 1589 return string 1590 The generated submit button tag 1591 submitInput() public static method 1592 Generates a submit input button. 1593 1594 Be careful when naming form elements such as submit buttons. According to the jQuery documentation there are some reserved names that can cause conflicts, e.g. submit, length, or method. 1595 public static string submitInput ( $label = 'Submit', $options = [] ) 1596 $label string 1597 The value attribute. If it is null, the value attribute will not be generated. 1598 $options array 1599 The tag options in terms of name-value pairs. These will be rendered as the attributes of the resulting tag. The values will be HTML-encoded using encode(). If a value is null, the corresponding attribute will not be rendered. See renderTagAttributes() for details on how attributes are being rendered. 1600 return string 1601 The generated button tag 1602 tag() public static method 1603 Generates a complete HTML tag. 1604 1605 See also: 1606 1607 beginTag() 1608 endTag() 1609 public static string tag ( $name, $content = '', $options = [] ) 1610 $name string|boolean|null 1611 The tag name. If $name is null or false, the corresponding content will be rendered without any tag. 1612 $content string 1613 The content to be enclosed between the start and end tags. It will not be HTML-encoded. If this is coming from end users, you should consider encode() it to prevent XSS attacks. 1614 $options array 1615 The HTML tag attributes (HTML options) in terms of name-value pairs. These will be rendered as the attributes of the resulting tag. The values will be HTML-encoded using encode(). If a value is null, the corresponding attribute will not be rendered. 1616 For example when using ['class' => 'my-class', 'target' => '_blank', 'value' => null] it will result in the html attributes rendered like this: class="my-class" target="_blank". 1617 See renderTagAttributes() for details on how attributes are being rendered. 1618 return string 1619 The generated HTML tag 1620 textInput() public static method 1621 Generates a text input field. 1622 public static string textInput ( $name, $value = null, $options = [] ) 1623 $name string 1624 The name attribute. 1625 $value string 1626 The value attribute. If it is null, the value attribute will not be generated. 1627 $options array 1628 The tag options in terms of name-value pairs. These will be rendered as the attributes of the resulting tag. The values will be HTML-encoded using encode(). If a value is null, the corresponding attribute will not be rendered. See renderTagAttributes() for details on how attributes are being rendered. 1629 return string 1630 The generated text input tag 1631 textarea() public static method 1632 Generates a text area input. 1633 public static string textarea ( $name, $value = '', $options = [] ) 1634 $name string 1635 The input name 1636 $value string 1637 The input value. Note that it will be encoded using encode(). 1638 $options array 1639 The tag options in terms of name-value pairs. These will be rendered as the attributes of the resulting tag. The values will be HTML-encoded using encode(). If a value is null, the corresponding attribute will not be rendered. See renderTagAttributes() for details on how attributes are being rendered. The following special options are recognized: 1640 doubleEncode: whether to double encode HTML entities in $value. If false, HTML entities in $value will not be further encoded. This option is available since version 2.0.11. 1641 return string 1642 The generated text area tag 1643 ul() public static method 1644 Generates an unordered list. 1645 public static string ul ( $items, $options = [] ) 1646 $items array|Traversable 1647 The items for generating the list. Each item generates a single list item. Note that items will be automatically HTML encoded if $options['encode'] is not set or true. 1648 $options array 1649 Options (name => config) for the radio button list. The following options are supported: 1650 encode: boolean, whether to HTML-encode the items. Defaults to true. This option is ignored if the item option is specified. 1651 separator: string, the HTML code that separates items. Defaults to a simple newline ("\n"). This option is available since version 2.0.7. 1652 itemOptions: array, the HTML attributes for the li tags. This option is ignored if the item option is specified. 1653 item: callable, a callback that is used to generate each individual list item. The signature of this callback must be: 1654 function ($item, $index) 1655 where $index is the array key corresponding to $item in $items. The callback should return the whole list item tag. 1656 See renderTagAttributes() for details on how attributes are being rendered. 1657 return string 1658 The generated unordered list. An empty list tag will be returned if $items is empty. 1659 1660 */ 1661 1662 enum TextDirections : string { 1663 LeftToRight = "ltr", // text direction 1664 RightToLeft = "rtl", // Right-to-left text direction 1665 Auto = "auto" // Let the browser figure out the text direction, based on the content (only recommended if the text direction is unknown) 1666 } 1667 1668 enum DraggableModes : string { 1669 IsDraggable = "true", // Specifies that the element is draggable 1670 NotDraggable = "false", // Specifies that the element in not draggable 1671 AutoDraggable = "auto" // Uses the default behavior of the browser 1672 } 1673 1674 unittest { 1675 // HTML.HEAD( 1676 // CSS 1677 // ("h1", ["color":"red"]) 1678 // ("h2", ["color":"blue"]), 1679 // HTML 1680 // (H1("xx", ["eins", "zwei"])) 1681 // (H1("xx", ["eins", "zwei"])), 1682 // JS 1683 // (VAR("x", "1")) 1684 // (IF("x>0", "x = 0")) 1685 // ) 1686 // .BODY( 1687 // CSS 1688 // ("h1", ["color":"red"]) 1689 // ("h2", ["color":"blue"]), 1690 // HTML 1691 // (H1("xx", ["eins", "zwei"])) 1692 // (H1("xx", ["eins", "zwei"])), 1693 // JS 1694 // (VAR("x", "1")) 1695 // (IF("x>0", "x = 0")) 1696 // ).toString; 1697 } 1698 1699 class DH5CENTER : DH5Obj { 1700 mixin(H5This!("CENTER")); 1701 } 1702 mixin(H5Short!"CENTER"); 1703 1704 unittest { 1705 1706 }