Commit 45987768 authored by Carsten  Rose's avatar Carsten Rose
Browse files

AbstractBuildForm.php: accidently a function duplicated - removed

parent 4283fe4d
......@@ -322,104 +322,6 @@ abstract class AbstractBuildForm {
abstract public function getProcessFilter();
/**
* Check if there is an explicit 'autofocus' definition in at least one FE.
* Found: do nothing, it will be rendered at the correct position.
* Not found: set 'autofocus' on the first FE.
*
* Accepted misbehaviour on forms with pills: if there is at least one editable element on the first pill,
* the other pills are not checked - independent if there was a definition on the first pill or not.
* Reason: checks happens per pill - if there is no explizit definition on the first pill, take the first editable
* element of that pill.
*/
private function checkAutoFocus() {
static $found = false;
$idx = false;
if ($found) {
return;
}
// Search if there is an explicit autofocus definition.
for ($i = 0; $i < count($this->feSpecNative); ++$i) {
// Only check native elements which will be shown
if ($this->feSpecNative[$i][FE_CLASS] == FE_CLASS_NATIVE &&
($this->feSpecNative[$i][FE_MODE] == FE_MODE_SHOW || $this->feSpecNative[$i][FE_MODE] == FE_MODE_REQUIRED)
) {
// Check if there is an explicit definition.
if (isset($this->feSpecNative[$i][FE_AUTOFOCUS])) {
if ($this->feSpecNative[$i][FE_AUTOFOCUS] == '' || $this->feSpecNative[$i][FE_AUTOFOCUS] == '1') {
$this->feSpecNative[$i][FE_AUTOFOCUS] = '1'; // fix to '=1'
} else {
unset($this->feSpecNative[$i][FE_AUTOFOCUS]);
}
$found = true;
return;
}
if ($idx === false) {
$idx = $i;
}
}
}
// No explicit definition found: take the first found editable element.
if ($idx !== false) {
$found = true;
// No explicit definition found: set autofocus.
$this->feSpecNative[$idx][FE_AUTOFOCUS] = '1';
}
}
/**
* Check if there is an explicit 'autofocus' definition in at least one FE.
* Found: do nothing, it will be rendered at the correct position.
* Not found: set 'autofocus' on the first FE.
*
* Accepted misbehaviour on forms with pills: if there is at least one editable element on the first pill,
* the other pills are not checked - independent if there was a definition on the first pill or not.
* Reason: checks happens per pill - if there is no explizit definition on the first pill, take the first editable
* element of that pill.
*/
private function checkAutoFocus() {
static $found = false;
$idx = false;
if ($found) {
return;
}
// Search if there is an explicit autofocus definition.
for ($i = 0; $i < count($this->feSpecNative); ++$i) {
// Only check native elements which will be shown
if ($this->feSpecNative[$i][FE_CLASS] == FE_CLASS_NATIVE &&
($this->feSpecNative[$i][FE_MODE] == FE_MODE_SHOW || $this->feSpecNative[$i][FE_MODE] == FE_MODE_REQUIRED)
) {
// Check if there is an explicit definition.
if (isset($this->feSpecNative[$i][FE_AUTOFOCUS])) {
if ($this->feSpecNative[$i][FE_AUTOFOCUS] == '' || $this->feSpecNative[$i][FE_AUTOFOCUS] == '1') {
$this->feSpecNative[$i][FE_AUTOFOCUS] = '1'; // fix to '=1'
} else {
unset($this->feSpecNative[$i][FE_AUTOFOCUS]);
}
$found = true;
return;
}
if ($idx === false) {
$idx = $i;
}
}
}
// No explicit definition found: take the first found editable element.
if ($idx !== false) {
$found = true;
// No explicit definition found: set autofocus.
$this->feSpecNative[$idx][FE_AUTOFOCUS] = '1';
}
}
/**
* Process all FormElements: build corresponding HTML code. Collect and return all HTML code.
*
......@@ -537,6 +439,55 @@ abstract class AbstractBuildForm {
return $html;
}
/**
* Check if there is an explicit 'autofocus' definition in at least one FE.
* Found: do nothing, it will be rendered at the correct position.
* Not found: set 'autofocus' on the first FE.
*
* Accepted misbehaviour on forms with pills: if there is at least one editable element on the first pill,
* the other pills are not checked - independent if there was a definition on the first pill or not.
* Reason: checks happens per pill - if there is no explizit definition on the first pill, take the first editable
* element of that pill.
*/
private function checkAutoFocus() {
static $found = false;
$idx = false;
if ($found) {
return;
}
// Search if there is an explicit autofocus definition.
for ($i = 0; $i < count($this->feSpecNative); ++$i) {
// Only check native elements which will be shown
if ($this->feSpecNative[$i][FE_CLASS] == FE_CLASS_NATIVE &&
($this->feSpecNative[$i][FE_MODE] == FE_MODE_SHOW || $this->feSpecNative[$i][FE_MODE] == FE_MODE_REQUIRED)
) {
// Check if there is an explicit definition.
if (isset($this->feSpecNative[$i][FE_AUTOFOCUS])) {
if ($this->feSpecNative[$i][FE_AUTOFOCUS] == '' || $this->feSpecNative[$i][FE_AUTOFOCUS] == '1') {
$this->feSpecNative[$i][FE_AUTOFOCUS] = '1'; // fix to '=1'
} else {
unset($this->feSpecNative[$i][FE_AUTOFOCUS]);
}
$found = true;
return;
}
if ($idx === false) {
$idx = $i;
}
}
}
// No explicit definition found: take the first found editable element.
if ($idx !== false) {
$found = true;
// No explicit definition found: set autofocus.
$this->feSpecNative[$idx][FE_AUTOFOCUS] = '1';
}
}
abstract public function fillWrapLabelInputNote($label, $input, $note);
abstract public function tail();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment