Skip to content

How to use make_setup_config.php

johnkawakami edited this page Sep 14, 2010 · 1 revision

This is a script that spits out some PHP code so you don’t have to type so much.

Imagine that you’ve created a widget. You have defined setup_table() with code to create the table. You have used config_add_column() several times to add some configuration data.

Now you need to write some admin_add_field() calls to create the UI hints. That’s when you should run make_setup_config.php.

All it does is read the config table, and generate some PHP code with the admin_add_field() calls, all populated with some dummy data.

Find the lines for your new fields, and copy-paste the code into your code.

Then, perform a search-and-replace. Search for ‘layout’, and replace it with ‘widget_widgetname’. This controls the grouping for the admin fields.

Rearrange it for neatness if you wish.

Clone this wiki locally