ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilADTTextActiveRecordBridge.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
6 {
7  protected function isValidADT(ilADT $a_adt): bool
8  {
9  return ($a_adt instanceof ilADTText);
10  }
11 
12  public function getActiveRecordFields(): array
13  {
14  $def = $this->getADT()->getCopyOfDefinition();
15 
16  $field = new arField();
17  $field->setHasField(true);
18  $field->setNotNull(!$def->isNullAllowed());
19  $field->setFieldType(arField::FIELD_TYPE_TEXT);
20  $field->setName($this->getElementId());
21 
22  $max = $def->getMaxLength();
23  if ($max !== null) {
24  $field->setLength($max);
25  }
26 
27  return array($field);
28  }
29 
30  public function getFieldValue(string $a_field_name)
31  {
32  return $this->getADT()->getText();
33  }
34 
35  public function setFieldValue(string $a_field_name, $a_field_value): void
36  {
37  $this->getADT()->setText($a_field_value);
38  }
39 }
Class arField.
const FIELD_TYPE_TEXT
ADT base class.
Definition: class.ilADT.php:11
setFieldValue(string $a_field_name, $a_field_value)