ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
NameSync.php
Go to the documentation of this file.
1<?php
2
9{
10
11 public function __construct()
12 {
13 $this->idDef = new HTMLPurifier_AttrDef_HTML_ID();
14 }
15
22 public function transform($attr, $config, $context)
23 {
24 if (!isset($attr['name'])) {
25 return $attr;
26 }
27 $name = $attr['name'];
28 if (isset($attr['id']) && $attr['id'] === $name) {
29 return $attr;
30 }
31 $result = $this->idDef->validate($name, $config, $context);
32 if ($result === false) {
33 unset($attr['name']);
34 } else {
35 $attr['name'] = $result;
36 }
37 return $attr;
38 }
39}
40
41// vim: et sw=4 sts=4
$result
Validates the HTML attribute ID.
Definition: ID.php:13
Post-transform that performs validation to the name attribute; if it is present with an equivalent id...
Definition: NameSync.php:9
transform($attr, $config, $context)
Definition: NameSync.php:22
Processes an entire attribute array for corrections needing multiple values.