I am not so familiar but sure there should be some way to shorten my code. I am having multi-dimention array as below.
return array(
'save' => 'here is the save message',
'options' => array(
// section for item 1
array(
'name' => 'Item 1',
'type' => 'text',
'id' => 'item_1_type_1',
),
array(
'name' => 'Item 2',
'type' => 'text',
'id' => 'item_1_type_2',
),
array(
'name' => 'Item 3',
'type' => 'text',
'id' => 'item_1_type_3',
),
// section for item 2
array(
'name' => 'Item 1',
'type' => 'text',
'id' => 'item_2_type_1',
),
array(
'name' => 'Item 2',
'type' => 'text',
'id' => 'item_2_type_2',
),
array(
'name' => 'Item 3',
'type' => 'text',
'id' => 'item_2_type_3',
),
// here I also may add more fields aprart from loop
// but that would be an array with the same format
'submit' => array(
'name' => 'Save Options',
'id' => 'save_theme_options'
),
),
);
Now I have total 10 items (please refer id) and each item has 10 fields (in reference code only 3). So if I would write code for each field it will become massive around 100 array so I am looking for some way where I can repeat loop for each item.
I hope I explained properly..