Commit 072c2f2c authored by David Barratt's avatar David Barratt
Browse files

Issue #2310239 Add Parents after Field Group.

parent b5a75928
Loading
Loading
Loading
Loading
+29 −0
Changes for modules/insert_field_ui/insert_field_ui.install: 29 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?php

/**
 * Implements hook_install().
 */
function insert_field_ui_install() {

  // Set module weight to 2 so this module
  // processes after Field Group.
  db_update('system')
    ->fields(array('weight' => 2))
    ->condition('name', 'insert_field_ui')
    ->execute();

}

/**
 * Increase the Weight of Insert Field so it is
 * processed after Field Group.
 */
function insert_field_ui_update_7001() {

  // Set module weight to 2.
  db_update('system')
    ->fields(array('weight' => 2))
    ->condition('name', 'insert_field_ui')
    ->execute();

}
+11 −2
Changes for modules/insert_field_ui/insert_field_ui.module: 11 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -452,7 +452,7 @@ function insert_field_ui_field_attach_submit($entity_type, $entity, $form, &$for
 *
 * Alters the Field UI Display for easy insert configuration.
 */
function insert_field_form_field_ui_display_overview_form_alter(&$form, &$form_state, $entity_type, $bundle) {
function insert_field_ui_form_field_ui_display_overview_form_alter(&$form, &$form_state, $entity_type, $bundle) {
  $entity_type = $form['#entity_type'];
  $bundle = $form['#bundle'];
  $view_mode = $form['#view_mode'];
@@ -568,7 +568,16 @@ function insert_field_ui_format_fields($form, $settings) {
      $parent = $settings[$field]['parent'];
      $form['fields'][$field]['parent_wrapper']['parent']['#default_value'] = $parent;
    }
    $form['fields'][$field]['parent_wrapper']['parent']['#options'] = $parents;

    $options = array();

    // If the Field already has Parent Options, get those choices.
    if (!empty($form['fields'][$field]['parent_wrapper']['parent']['#options'])) {
      $options = $form['fields'][$field]['parent_wrapper']['parent']['#options'];
    }

    // Set the new Options
    $form['fields'][$field]['parent_wrapper']['parent']['#options'] = array_merge($options, $parents);

  }