Array
(
[table] => Array
(
[#type] => tableselect
[#header] => Array
(
[field_name] => FIELD NAME
[field_type] => FIELD TYPE
[no_of_values] => NO OF VALUES
[display_fields] => DISPLAY FIELDS
[field_label] => FIELD LABEL
[required] => Required
[product_type] => Product Type
)
[#options] => Array
(
[field_colour_pro] => Array
(
[field_name] => field_colour_pro
[field_type] =>
[no_of_values] =>
[display_fields] => 1
[field_label] => color
[required] => 0
[product_type] => shirt
)
[field_description] => Array
(
[field_name] => field_description
[field_type] =>
[no_of_values] =>
[display_fields] => 1
[field_label] => description
[required] => 0
[product_type] => test_pro_v
)
)
[#multiple] => 1
)
$header = array(
'field_name' => t('FIELD NAME'),
'field_type' => t('FIELD TYPE'),
'no_of_values' => t('NO OF VALUES'),
'display_fields' => t('DISPLAY FIELDS'),
'field_label' => t('FIELD LABEL'),
'required' => t('Required'),
'product_type' => t('Product Type'),
);
$rows = array();
foreach(commerce_product_types() as $product_type => $product_type_array){
$field_info = field_info_instances('commerce_product',$product_type);
foreach($field_info as $machine_name =>$field_details){
$rows[$machine_name] = array(
'field_name' => $machine_name,
'field_type' => $field_details['type'],
'no_of_values' => $field_details['cardinality'],
'display_fields'=>1,
'field_label' => $field_details['label'],
'required' => $field_details['required'],
'product_type'=> $product_type,
);
}
}
$form['table'] = array(
'#type' => 'tableselect',
'#header' => $header,
'#options' => $rows,
'#multiple' => TRUE,
);
// print_r($form);
$form['save'] = array(
'#type' => 'submit',
'#value' => t('Save'),
);
return $form;
I tried to get the tableselect form #type into operation it does not work and gives empty row even when each row has values,I would like to help me find any silly mistake which I am making out here
Here is image of how the table select looks which is empty