|
@@ -98,8 +98,7 @@ function tripal_fields_layout_form_field_ui_display_overview_form_alter(&$form,
|
|
|
t('Parent'),
|
|
|
t('Label'),
|
|
|
array('data' => t('Format'), 'colspan' => 3),
|
|
|
- t('Region'),
|
|
|
- t('Panel Layout')
|
|
|
+ t('Region')
|
|
|
);
|
|
|
|
|
|
// Change the region callback for each field to place each field in the
|
|
@@ -130,15 +129,6 @@ function tripal_fields_layout_form_field_ui_display_overview_form_alter(&$form,
|
|
|
'class' => array('te-field-region'),
|
|
|
)
|
|
|
);
|
|
|
- $layout_options = array ('Default', 'Vertical Table', 'Horizontal Table', '[Add a Horizontal Table]', '[Add a Vertical Table]');
|
|
|
- $form['fields'][$field_name]['layout'] = array(
|
|
|
- '#type' => 'select',
|
|
|
- '#options' => $layout_options,
|
|
|
- '#default_value' => 'Default',
|
|
|
- '#attributes' => array(
|
|
|
- 'class' => array('te-field-layout'),
|
|
|
- )
|
|
|
- );
|
|
|
$form['fields'][$field_name]['#field_instance_id'] = array(
|
|
|
'#type' => 'value',
|
|
|
'#value' => $field_instance['id']
|
|
@@ -277,11 +267,14 @@ function tripal_fields_layout_form_field_ui_display_overview_form_panel_configur
|
|
|
->condition('bundle_id', $bundle->id)
|
|
|
->orderby('weight', 'asc')
|
|
|
->execute();
|
|
|
+ // Add a dropdown for selecting panel to configure
|
|
|
+ foreach ($panels as $panel) {
|
|
|
+
|
|
|
+ }
|
|
|
$has_panel = FALSE;
|
|
|
foreach ($panels as $panel) {
|
|
|
$panel_settings = unserialize($panel->settings);
|
|
|
- $hz_table = key_exists('hz_table', $panel_settings) ? $panel_settings['hz_table'] : array();
|
|
|
- $vt_table = key_exists('vt_table', $panel_settings) ? $panel_settings['vt_table'] : array();
|
|
|
+ $table_layout = key_exists('table_layout', $panel_settings) ? $panel_settings['table_layout'] : array();
|
|
|
$form['te_configure_panels']['panel_items'][$panel->panel_id] = array(
|
|
|
'#type' => 'fieldset',
|
|
|
'#title' => check_plain($panel->label),
|
|
@@ -312,18 +305,14 @@ function tripal_fields_layout_form_field_ui_display_overview_form_panel_configur
|
|
|
'#title' => $flable,
|
|
|
);
|
|
|
$default_value = 0;
|
|
|
- if (in_array($fname, $hz_table)) {
|
|
|
+ if (in_array($fname, $table_layout)) {
|
|
|
$default_value = 1;
|
|
|
}
|
|
|
- else if (in_array($fname, $vt_table)) {
|
|
|
- $default_value = 2;
|
|
|
- }
|
|
|
$form['te_configure_panels']['panel_items'][$panel->panel_id][$fname]['table_group'] = array(
|
|
|
'#type' => 'radios',
|
|
|
'#options' => array(
|
|
|
- 0 => 'No Group',
|
|
|
- 1 => 'Horizontal Table',
|
|
|
- 2 => 'Vertical Table'
|
|
|
+ 0 => 'Default',
|
|
|
+ 1 => 'Table',
|
|
|
),
|
|
|
'#default_value' => $default_value,
|
|
|
);
|
|
@@ -707,15 +696,11 @@ function tripal_fields_layout_action_configure_panels (&$form, &$form_state) {
|
|
|
$panels = $form_state['values']['panel_items'];
|
|
|
|
|
|
foreach ($panels AS $id => $panel) {
|
|
|
- $hz_table = array();
|
|
|
- $vt_table = array();
|
|
|
+ $table_layout = array();
|
|
|
foreach($panel AS $key => $value) {
|
|
|
if (is_array($value) && key_exists('table_group', $value)) {
|
|
|
if ($value['table_group'] == 1) {
|
|
|
- $hz_table[] = $key;
|
|
|
- }
|
|
|
- else if ($value['table_group'] == 2) {
|
|
|
- $vt_table[] = $key;
|
|
|
+ $table_layout[] = $key;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -725,8 +710,7 @@ function tripal_fields_layout_action_configure_panels (&$form, &$form_state) {
|
|
|
->execute()
|
|
|
->fetchField();
|
|
|
$new_settings = unserialize($panel_settings);
|
|
|
- $new_settings['hz_table'] = $hz_table;
|
|
|
- $new_settings['vt_table'] = $vt_table;
|
|
|
+ $new_settings['table_layout'] = $table_layout;
|
|
|
db_update('tripal_panels')
|
|
|
->fields(array(
|
|
|
'settings' => serialize($new_settings)
|
|
@@ -759,7 +743,7 @@ function theme_tripal_fields_layout_form_configure_panels ($variables) {
|
|
|
}
|
|
|
|
|
|
// Create table header
|
|
|
- $header = array(t('Field'), t('Table Group'));
|
|
|
+ $header = array(t('Field'), t('Layout'));
|
|
|
|
|
|
// Create a unique id for drupal_add_tabledrag() to find the table object
|
|
|
$table_id = 'tripal_panel-configure_panel_table-' . strtolower(preg_replace('/\s+/', '_', $element['#title']));
|
|
@@ -783,7 +767,8 @@ function theme_tripal_fields_layout_form_configure_panels ($variables) {
|
|
|
<div>'
|
|
|
. $table;
|
|
|
$collapsible_item['element']['#title'] = $element['#title'];
|
|
|
- $collapsible_item['element']['#attributes']['class'] = array('tripal_fields_layout-panel_configure-fieldset', 'collapsible');
|
|
|
+ // add 'collapsible' to the class setting to enable collapsible fieldset
|
|
|
+ $collapsible_item['element']['#attributes']['class'] = array('tripal_fields_layout-panel_configure-fieldset');
|
|
|
$output = theme('fieldset', $collapsible_item);
|
|
|
return $output;
|
|
|
}
|