Make use if 'ignore´ instead of explicitly unsetting array keys

refs #5525
This commit is contained in:
Johannes Meyer 2014-08-12 13:57:28 +02:00
parent e6bcda260d
commit fe63ce664f
11 changed files with 32 additions and 42 deletions

View File

@ -57,7 +57,8 @@ class LoginForm extends Form
'submit', 'submit',
'btn_submit', 'btn_submit',
array( array(
'label' => t('Login') 'ignore' => true,
'label' => t('Login')
) )
); );
} }

View File

@ -20,7 +20,8 @@ abstract class BaseBackendForm extends Form
'submit', 'submit',
'btn_submit', 'btn_submit',
array( array(
'label' => t('Save Changes') 'ignore' => true,
'label' => t('Save Changes')
) )
); );
@ -75,9 +76,6 @@ abstract class BaseBackendForm extends Form
$values = $this->getValues(); $values = $this->getValues();
$name = $values['name']; $name = $values['name'];
unset($values['name']); unset($values['name']);
unset($values['btn_submit']);
unset($values['force_creation']);
unset($values[$this->getTokenElementName()]);
return array($name, $values); return array($name, $values);
} }
@ -104,6 +102,7 @@ abstract class BaseBackendForm extends Form
'force_creation', 'force_creation',
array( array(
'order' => 0, 'order' => 0,
'ignore' => true,
'label' => t('Force Changes'), 'label' => t('Force Changes'),
'helptext' => t('Check this box to enforce changes without connectivity validation') 'helptext' => t('Check this box to enforce changes without connectivity validation')
) )

View File

@ -28,7 +28,8 @@ class ConfirmRemovalForm extends Form
'submit', 'submit',
'btn_submit', 'btn_submit',
array( array(
'label' => t('Confirm Removal') 'ignore' => true,
'label' => t('Confirm Removal')
) )
); );
} }

View File

@ -46,7 +46,8 @@ class GeneralForm extends Form
'submit', 'submit',
'btn_submit', 'btn_submit',
array( array(
'label' => t('Save Changes') 'ignore' => true,
'label' => t('Save Changes')
) )
); );

View File

@ -134,28 +134,14 @@ class LoggingForm extends Form
'submit', 'submit',
'btn_submit', 'btn_submit',
array( array(
'label' => t('Save') 'ignore' => true,
'label' => t('Save')
) )
); );
return $this; return $this;
} }
/**
* Retrieve all form element values
*
* Returns all configuration relevant element values.
*
* @return array
*/
public function getValues()
{
$values = parent::getValues();
unset($values['btn_submit']);
unset($values[$this->getTokenElementName()]);
return $values;
}
/** /**
* Return the default logging directory for type "file" * Return the default logging directory for type "file"
* *

View File

@ -83,7 +83,8 @@ class ResourceForm extends Form
'submit', 'submit',
'btn_submit', 'btn_submit',
array( array(
'label' => t('Save Changes') 'ignore' => true,
'label' => t('Save Changes')
) )
); );
@ -197,9 +198,6 @@ class ResourceForm extends Form
$values = $this->getValues(); $values = $this->getValues();
$name = $values['name']; $name = $values['name'];
unset($values['name']); unset($values['name']);
unset($values['btn_submit']);
unset($values['force_creation']);
unset($values[$this->getTokenElementName()]);
return array($name, $values); return array($name, $values);
} }
@ -228,6 +226,7 @@ class ResourceForm extends Form
'force_creation', 'force_creation',
array( array(
'order' => 0, 'order' => 0,
'ignore' => true,
'label' => t('Force Changes'), 'label' => t('Force Changes'),
'helptext' => t('Check this box to enforce changes without connectivity validation') 'helptext' => t('Check this box to enforce changes without connectivity validation')
) )

View File

@ -56,8 +56,9 @@ class AddUrlForm extends Form
'submit', 'submit',
'use_existing_dashboard', 'use_existing_dashboard',
array( array(
'label' => t('Use An Existing Pane'), 'ignore' => true,
'style' => 'display: inline-block' 'label' => t('Use An Existing Pane'),
'style' => 'display: inline-block'
) )
); );
} }
@ -76,8 +77,9 @@ class AddUrlForm extends Form
'submit', 'submit',
'create_new_pane', 'create_new_pane',
array( array(
'label' => t('Create A New Pane'), 'ignore' => true,
'style' => 'display: inline-block' 'label' => t('Create A New Pane'),
'style' => 'display: inline-block'
) )
); );
} }
@ -103,7 +105,8 @@ class AddUrlForm extends Form
'submit', 'submit',
'btn_submit', 'btn_submit',
array( array(
'label' => t('Add To Dashboard') 'ignore' => true,
'label' => t('Add To Dashboard')
) )
); );

View File

@ -138,7 +138,8 @@ class GeneralForm extends Form
'submit', 'submit',
'btn_submit', 'btn_submit',
array( array(
'label' => t('Save Changes') 'ignore' => true,
'label' => t('Save Changes')
) )
); );

View File

@ -216,7 +216,8 @@ class Form extends Zend_Form
'hidden', 'hidden',
$this->tokenElementName, $this->tokenElementName,
array( array(
'value' => $this->generateCsrfToken() 'ignore' => true,
'value' => $this->generateCsrfToken()
) )
); );
} }

View File

@ -74,7 +74,8 @@ class BackendForm extends Form
'submit', 'submit',
'btn_submit', 'btn_submit',
array( array(
'label' => t('Save Changes') 'ignore' => true,
'label' => t('Save Changes')
) )
); );
@ -98,8 +99,6 @@ class BackendForm extends Form
} }
unset($values['name']); unset($values['name']);
unset($values['btn_submit']);
unset($values[$this->getTokenElementName()]);
return array($name, $values); return array($name, $values);
} }

View File

@ -33,6 +33,7 @@ class InstanceForm extends Form
'type', 'type',
array( array(
'required' => true, 'required' => true,
'ignore' => true,
'label' => t('Instance Type'), 'label' => t('Instance Type'),
'class' => 'autosubmit', 'class' => 'autosubmit',
'helptext' => t( 'helptext' => t(
@ -92,6 +93,7 @@ class InstanceForm extends Form
'hitchhiker', 'hitchhiker',
array( array(
'required' => true, 'required' => true,
'ignore' => true,
'value' => 'Arthur' 'value' => 'Arthur'
) )
); );
@ -119,7 +121,8 @@ class InstanceForm extends Form
'submit', 'submit',
'btn_submit', 'btn_submit',
array( array(
'label' => t('Save Changes') 'ignore' => true,
'label' => t('Save Changes')
) )
); );
@ -138,10 +141,6 @@ class InstanceForm extends Form
$values = $this->getValues(); $values = $this->getValues();
$name = $values['name']; $name = $values['name'];
unset($values['name']); unset($values['name']);
unset($values['type']);
unset($values['hitchhiker']);
unset($values['btn_submit']);
unset($values[$this->getTokenElementName()]);
return array($name, $values); return array($name, $values);
} }