ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilADTTextActiveRecordBridge.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22{
23 protected function isValidADT(ilADT $a_adt): bool
24 {
25 return ($a_adt instanceof ilADTText);
26 }
27
28 public function getActiveRecordFields(): array
29 {
30 $def = $this->getADT()->getCopyOfDefinition();
31
32 $field = new arField();
33 $field->setHasField(true);
34 $field->setNotNull(!$def->isNullAllowed());
35 $field->setFieldType(arField::FIELD_TYPE_TEXT);
36 $field->setName($this->getElementId());
37
38 $max = $def->getMaxLength();
39 if ($max !== null) {
40 $field->setLength($max);
41 }
42
43 return array($field);
44 }
45
46 public function getFieldValue(string $a_field_name)
47 {
48 return $this->getADT()->getText();
49 }
50
51 public function setFieldValue(string $a_field_name, $a_field_value): void
52 {
53 $this->getADT()->setText($a_field_value);
54 }
55}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const FIELD_TYPE_TEXT
getFieldValue(string $a_field_name)
Get field value.
getActiveRecordFields()
Convert ADT to active record fields.
setFieldValue(string $a_field_name, $a_field_value)
Set field value.
ADT base class.
Definition: class.ilADT.php:26