Hello,

I think the admin settings form needs refactoring. the form (code) is a little confusing to read and has a few superfluous variables that aren't really needed.

I factored out the $is_setup into its own function and used this for defining collapsed fields which makes much more sense. For example: '#collapsed' => $is_setup instead of '#collapsed' => $collapsed.

I factored out the forms that can be altered and set them with variable_get so other developers can extend this without altering code.

You've also got tabs and whitespace mixed up.

I think the defined vars for form names make this module a little harder to understand. You could also leverage the system_settings_form function which sets the defaults for each element with variable_get() by default. This could remove a lot of code.

Hope this helps....

Rim

CommentFileSizeAuthor
refactored_admin_less_code.patch7.67 KBrimian

Comments

ssherriff’s picture

Thanks a bunch for the help.

I might re-write the admin page completely, but I'll definitely keep in mind what you did here when I make any of my changes.

cableman0408’s picture

Status: Active » Closed (fixed)

Most off the changes in the patch have been applied to the code and the form is now located in campaignmonitor.admin.inc.