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',
'btn_submit',
array(
'label' => t('Login')
'ignore' => true,
'label' => t('Login')
)
);
}

View File

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

View File

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

View File

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

View File

@ -134,28 +134,14 @@ class LoggingForm extends Form
'submit',
'btn_submit',
array(
'label' => t('Save')
'ignore' => true,
'label' => t('Save')
)
);
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"
*

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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