|
@@ -60,6 +60,9 @@ function tripal_fields_layout_form_field_ui_display_overview_form_alter(&$form,
|
|
|
'#collapsed' => TRUE,
|
|
|
'#group' => 'overview_vert_tabs'
|
|
|
);
|
|
|
+
|
|
|
+ // Make sure our default panels are in the database.
|
|
|
+ _tripal_fields_layout_check_default_field_panels($bundle);
|
|
|
|
|
|
// Add a Panel
|
|
|
tripal_fields_layout_form_field_ui_display_overview_form_panel_add($form, $form_state);
|
|
@@ -70,9 +73,6 @@ function tripal_fields_layout_form_field_ui_display_overview_form_alter(&$form,
|
|
|
// Configure Panels
|
|
|
tripal_fields_layout_form_field_ui_display_overview_form_panel_configure($form, $bundle);
|
|
|
|
|
|
- // Make sure our default panels are in the database.
|
|
|
- _tripal_fields_layout_check_default_field_panels($bundle);
|
|
|
-
|
|
|
// Now add each panel as a region.
|
|
|
$form['fields']['#regions'] = array();
|
|
|
$panels = db_select('tripal_panels', 'tp')
|
|
@@ -366,6 +366,41 @@ function _tripal_fields_layout_check_default_field_panels($bundle) {
|
|
|
))
|
|
|
->execute();
|
|
|
}
|
|
|
+ // Now add all fields to the default region if they are not assigned
|
|
|
+ $panel_id = db_select('tripal_panels', 'tp')
|
|
|
+ ->fields('tp', array('panel_id'))
|
|
|
+ ->condition('name', 'te_base')
|
|
|
+ ->condition('bundle_id', $bundle->id)
|
|
|
+ ->execute()
|
|
|
+ ->fetchField();
|
|
|
+ $fields = db_select('field_config_instance', 'fci')
|
|
|
+ ->fields('fci', array('id'))
|
|
|
+ ->condition('entity_type', $bundle->type)
|
|
|
+ ->condition('bundle', $bundle->bundle)
|
|
|
+ ->execute();
|
|
|
+ foreach($fields AS $field) {
|
|
|
+ $penal_field_id = db_select('tripal_panel_fields', 'tpf')
|
|
|
+ ->fields('tpf', array('panel_field_id'))
|
|
|
+ ->condition('field_id', $field->id)
|
|
|
+ ->execute()
|
|
|
+ ->fetchField();
|
|
|
+ if ($penal_field_id) {
|
|
|
+ db_update('tripal_panel_fields')
|
|
|
+ ->fields(array(
|
|
|
+ 'panel_id' => $panel_id,
|
|
|
+ ))
|
|
|
+ ->condition('panel_field_id', $penal_field_id)
|
|
|
+ ->execute();
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ db_insert('tripal_panel_fields')
|
|
|
+ ->fields(array(
|
|
|
+ 'panel_id' => $panel_id,
|
|
|
+ 'field_id' => $field->id
|
|
|
+ ))
|
|
|
+ ->execute();
|
|
|
+ }
|
|
|
+ }
|
|
|
// Next check if the hidden region is in the database. If not, add it.
|
|
|
$te_base = db_select('tripal_panels', 'tp')
|
|
|
->fields('tp')
|