Active
Project:
Form Updater
Version:
master
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
15 Nov 2005 at 08:48 UTC
Updated:
15 Nov 2005 at 08:54 UTC
Amazon had asked me to look at this module and make suggestions if I found them, so here was one. Flipping AWESOME script, by the way. :)
It would be cool if this tool could check an element's default values (these can be found in system_elements) to determine if an attribute matches a default value, and if so remove it from the output.
Here's an example from project.module:
form_checkbox(t('Browse projects by releases'), 'project_browse_releases', 1, variable_get('project_browse_releases', 1), t('Checking this box will cause the project browsing page to have version subtabs.'));
turned into:
$form['project_browse_releases'] = array(
'#type' => 'checkbox',
'#title' => t('Browse projects by releases'),
'#return_value' => 1,
'#default_value' => variable_get('project_browse_releases', 1),
'#description' => t('Checking this box will cause the project browsing page to have version subtabs.'),
);
However, #return_value already defaults to 1, so it is not required. Output would ideally look like:
$form['project_browse_releases'] = array(
'#type' => 'checkbox',
'#title' => t('Browse projects by releases'),
'#default_value' => variable_get('project_browse_releases', 1),
'#description' => t('Checking this box will cause the project browsing page to have version subtabs.'),
);
Now that the default values in system_elements are fairly reasonable, it might be cool to implement a feature like this.