TYPO3 CMS  TYPO3_6-2
OptionElement.php
Go to the documentation of this file.
1 <?php
3 
23 
29  protected $allowedAttributes = array(
30  'class' => '',
31  'disabled' => '',
32  'id' => '',
33  'label' => '',
34  'lang' => '',
35  'selected' => '',
36  'style' => '',
37  'title' => '',
38  'value' => ''
39  );
40 
46  protected $mandatoryAttributes = array();
47 
53  protected $parentName;
54 
61  public function getData() {
62  return $this->data;
63  }
64 
72  public function setParentName($parentName) {
73  $this->parentName = $parentName;
75  return $this;
76  }
77 
88  if ($this->value === '') {
89  $this->value = (string) $this->getElementId();
90  $this->setAttribute('value', $this->value);
91  }
92  if (!empty($this->parentName)) {
93  if ($this->requestHandler->has($this->parentName)) {
94  $submittedValue = $this->requestHandler->getByMethod($this->parentName);
95  if (is_array($submittedValue) && in_array($this->value, $submittedValue)) {
96  $this->setAttribute('selected', 'selected');
97  } elseif ($submittedValue === $this->value) {
98  $this->setAttribute('selected', 'selected');
99  } elseif (is_array($submittedValue) && in_array('on', $submittedValue)) {
100  $this->setAttribute('selected', 'selected');
101  } else {
102  $this->attributes->removeAttribute('selected');
103  }
104  } elseif ($this->requestHandler->hasRequest()) {
105  $this->attributes->removeAttribute('selected');
106  }
107  }
108  return $this;
109  }
110 
111 }