22 lines
769 B
PHP
22 lines
769 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
|
||
|
|
class RsvOutputTextElementHandler implements RsvFormElementHandler {
|
||
|
|
|
||
|
|
private const ALLOWED_TAGS = ['p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
||
|
|
|
||
|
|
public function draw(RsvFormElementDefinition $def): void {
|
||
|
|
$raw = $def->getAttr('tag', 'p');
|
||
|
|
$tag = in_array($raw, self::ALLOWED_TAGS, true) ? $raw : 'p';
|
||
|
|
echo '<' . $tag . ' class="rsv-form-output-text">' . esc_html($def->getLabel()) . '</' . $tag . '>';
|
||
|
|
}
|
||
|
|
|
||
|
|
public function submit(RsvFormElementDefinition $def, int $submit_id, array $data, RsvFormSubmitResult $result): bool {
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
|
||
|
|
public function rollback(RsvFormElementDefinition $def, int $submit_id, array $data, RsvFormSubmitResult $result): void {
|
||
|
|
// No side effects to undo.
|
||
|
|
}
|
||
|
|
}
|