updated field_group from 1.3 to 7.x-1.4
This commit is contained in:
parent
eeb0df349d
commit
4d3a184a81
@ -1,12 +1,23 @@
|
||||
/* $Id*/
|
||||
CHANGELOG for field_group for Drupal 7
|
||||
|
||||
Field_group 7.x-1.x-dev
|
||||
o Issue #1095316: Field Groups disappear when Content Type is renamed.
|
||||
o Issue #1095316 by swentel: Support for Entity API.
|
||||
o Issue #1095002 by animelion: Upgrading removes all existing field groups.
|
||||
o Issue #1095130 by willvincent: Features export not working with rc2.
|
||||
|
||||
Field_group 7.x-1.3
|
||||
o Issue #2077695 by FreekVR | ChoY: Fixed field group entity display bug after update.
|
||||
o Issue #2078201 by DeFr, eneko1907 | cmriley: Fixed Started getting a ton of notices.
|
||||
o Issue #2085137 by ar-jan: Fixed Collapse speed no longer works with field_group() 1.2
|
||||
o Issue #2085225 by dtarc: Fixed Featurized Field Groups no longer have classes since marked optional.
|
||||
o Issue #2080645 by bassthiam: Fixed Warning: Illegal string offset 'label' in field_group_unpack() line 1682 of field_group()/field_group().module.
|
||||
o Issue #1942676 by Harlor | El Bandito: Added Change the text 'Mark group for required fields.'.
|
||||
o Issue #1358430 by FriedJam: Fixed JS 'Error: uncaught exception: Syntax error, unrecognized expression:".
|
||||
o Issue #2084999 by activelink: Fixed Empty field groups aren't being suppressed since move to 7.x-1.2.
|
||||
o Issue #1557258 by Mark Trapp | Chris Gillis: Fixed Existing field groups disappear and Add Field Group UI is disabled when no fields are available.
|
||||
o Issue #2000110 by bigjim: Fixed Comments on field_group_read_groups() wrong
|
||||
o Issue #1169146 by ankur, Nephele | jeffrey.dalton: Fixed upgrade from 7.x-1.0-rc2 to 7.x-1.0 deletes all field_groups().
|
||||
o Vertical tabs always appear when children elements have no access
|
||||
o #1966624 Feature 7.x-2.0-beta2 defines fields in a new way
|
||||
o #2090415 Make horizontal tabs not dependent on form.js. Also change drupal_add_x to #attached
|
||||
o
|
||||
|
||||
Field_group 7.x-1.0-rc2
|
||||
o Ran through coder, minor.
|
||||
o Issue #1033036 by Stalski, swentel: Create a field_group.api.php.
|
||||
@ -20,7 +31,7 @@ Field_group 7.x-1.0-rc2
|
||||
o #1045526 by stalski: Make formatter options more user-friendly and logical.
|
||||
o #1041880 by robertgarrigos: duplicated entries in field_group table.
|
||||
o #1043834 by amsri: Field Group module just does not work with profiles 2.
|
||||
|
||||
|
||||
Field_group 7.x-1.0-rc1
|
||||
o #1006464 Change #groups to #fieldgroups because of name collapsing with form_process_fieldset
|
||||
o #1024184 fix collapsible when mode is set to open
|
||||
@ -34,7 +45,7 @@ Field_group 7.x-1.0-rc1
|
||||
o #961106 Fixed notice on entity type and bundle check.
|
||||
o #962072 by mori: Improve CSS for horizontal tabs & accordion.
|
||||
o Changed Fieldgroup API: defaults and instance_settings are now merged.
|
||||
o Changed save action so everything is gathered during form_state to
|
||||
o Changed save action so everything is gathered during form_state to
|
||||
postpone saving until the save button is hit.
|
||||
o Changed some important variable name, so it makes more sense and easier to read.
|
||||
o Add basic crud functions.
|
@ -2,7 +2,7 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Hooks provided by the Field group module.
|
||||
* Hooks provided by the Field Group module.
|
||||
*
|
||||
* Fieldgroup is a module that will wrap fields and other fieldgroups. Nothing more, nothing less.
|
||||
* For this there are formatters we can create on forms and view modes.
|
||||
|
@ -1,19 +1,14 @@
|
||||
name = Fieldgroup
|
||||
description = Fieldgroup
|
||||
name = Field Group
|
||||
description = "Provides the ability to group your fields on both form and display."
|
||||
package = Fields
|
||||
dependencies[] = field
|
||||
dependencies[] = ctools
|
||||
core = 7.x
|
||||
files[] = field_group.install
|
||||
files[] = field_group.module
|
||||
files[] = field_group.field_ui.inc
|
||||
files[] = field_group.form.inc
|
||||
files[] = field_group.features.inc
|
||||
files[] = tests/field_group.ui.test
|
||||
files[] = tests/field_group.display.test
|
||||
; Information added by drupal.org packaging script on 2013-09-25
|
||||
version = "7.x-1.3"
|
||||
; Information added by Drupal.org packaging script on 2014-06-04
|
||||
version = "7.x-1.4"
|
||||
core = "7.x"
|
||||
project = "field_group"
|
||||
datestamp = "1380124361"
|
||||
datestamp = "1401918529"
|
||||
|
||||
|
@ -310,8 +310,14 @@ function field_group_update_7006() {
|
||||
|
||||
// Only update feature field_groups this time.
|
||||
// Don't touch the fieldgroups in db.
|
||||
|
||||
if ($row->export_type == EXPORT_IN_CODE) {
|
||||
$classes = explode(" ", $row->data['format_settings']['instance_settings']['classes']);
|
||||
$classes = array();
|
||||
|
||||
if (isset($row->data['format_settings'], $row->data['format_settings']['instance_settings'], $row->data['format_settings']['instance_settings']['classes'])) {
|
||||
$classes = explode(" ", $row->data['format_settings']['instance_settings']['classes']);
|
||||
}
|
||||
|
||||
$optional_classes = array(str_replace("_", "-", $row->group_name), 'field-group-' . $row->data['format_type']);
|
||||
foreach ($optional_classes as $optional_class) {
|
||||
if (!in_array($optional_class, $classes)) {
|
||||
@ -325,3 +331,33 @@ function field_group_update_7006() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Id attributes are now a setting. This update will insert the old id in the setting so old
|
||||
* markup doesn't get broken. If you don't want an attribute, you can delete
|
||||
* them on the fieldgroup settings.
|
||||
*/
|
||||
function field_group_update_7007() {
|
||||
|
||||
ctools_include("export");
|
||||
|
||||
// Migrate the field groups so they have a unique identifier.
|
||||
$field_groups = ctools_export_load_object("field_group");
|
||||
foreach ($field_groups as $row) {
|
||||
if ($row->data['format_type'] == 'div' || $row->data['format_type'] == 'html5' || $row->data['format_type'] == 'html-element') {
|
||||
|
||||
// If mode is default, we don't know what view mode it was. Take full then.
|
||||
$view_mode = $row->mode == 'default' ? 'full' : $row->mode;
|
||||
$id = $row->entity_type . '_' . $row->bundle . '_' . $view_mode . '_' . $row->group_name;
|
||||
$row->data['format_settings']['instance_settings']['id'] = $id;
|
||||
}
|
||||
|
||||
if ($row->export_type == EXPORT_IN_CODE) {
|
||||
unset($row->id);
|
||||
drupal_write_record('field_group', $row);
|
||||
}
|
||||
else {
|
||||
drupal_write_record('field_group', $row, array('id'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -183,6 +183,7 @@ Drupal.FieldGroup.Effects.processDiv = {
|
||||
*/
|
||||
Drupal.behaviors.fieldGroup = {
|
||||
attach: function (context, settings) {
|
||||
settings.field_group = settings.field_group || Drupal.settings.field_group;
|
||||
if (settings.field_group == undefined) {
|
||||
return;
|
||||
}
|
||||
|
@ -244,6 +244,7 @@ function field_group_field_attach_delete_bundle($entity_type, $bundle) {
|
||||
* Implements hook_field_attach_form().
|
||||
*/
|
||||
function field_group_field_attach_form($entity_type, $entity, &$form, &$form_state, $langcode) {
|
||||
|
||||
$form['#attached']['css'][] = drupal_get_path('module', 'field_group') . '/field_group.field_ui.css';
|
||||
field_group_attach_groups($form, 'form', $form_state);
|
||||
$form['#pre_render'][] = 'field_group_form_pre_render';
|
||||
@ -291,7 +292,7 @@ function field_group_field_group_formatter_info() {
|
||||
'html-element' => array(
|
||||
'label' => t('HTML element'),
|
||||
'description' => t('This fieldgroup renders the inner content in a HTML element with classes and attributes.'),
|
||||
'instance_settings' => array('element' => 'div', 'classes' => '', 'attributes' => '', 'required_fields' => 1),
|
||||
'instance_settings' => array('element' => 'div', 'show_label' => 0, 'label_element' => 'div', 'classes' => '', 'attributes' => '', 'required_fields' => 1),
|
||||
),
|
||||
'div' => array(
|
||||
'label' => t('Div'),
|
||||
@ -303,7 +304,7 @@ function field_group_field_group_formatter_info() {
|
||||
'html5' => array(
|
||||
'label' => t('HTML5'),
|
||||
'description' => t('This fieldgroup renders the inner content in a semantic HTML5 wrapper'),
|
||||
'instance_settings' => array('wrapper' => '', 'classes' => ''),
|
||||
'instance_settings' => array('wrapper' => '', 'classes' => '', 'id' => ''),
|
||||
),
|
||||
'fieldset' => array(
|
||||
'label' => t('Fieldset'),
|
||||
@ -365,19 +366,19 @@ function field_group_field_group_formatter_info() {
|
||||
'html-element' => array(
|
||||
'label' => t('HTML element'),
|
||||
'description' => t('This fieldgroup renders the inner content in a HTML element with classes and attributes.'),
|
||||
'instance_settings' => array('element' => 'div', 'classes' => '', 'attributes' => '', 'required_fields' => 1),
|
||||
'instance_settings' => array('element' => 'div', 'show_label' => 0, 'label_element' => 'div', 'classes' => '', 'attributes' => '', 'required_fields' => 1),
|
||||
),
|
||||
'div' => array(
|
||||
'label' => t('Div'),
|
||||
'description' => t('This fieldgroup renders the inner content in a simple div with the title as legend.'),
|
||||
'format_types' => array('open', 'collapsible', 'collapsed'),
|
||||
'instance_settings' => array('description' => '', 'show_label' => 1, 'label_element' => 'h3', 'effect' => 'none', 'speed' => 'fast', 'classes' => ''),
|
||||
'instance_settings' => array('description' => '', 'show_label' => 1, 'label_element' => 'h3', 'effect' => 'none', 'speed' => 'fast', 'classes' => '', 'id' => ''),
|
||||
'default_formatter' => 'collapsible',
|
||||
),
|
||||
'html5' => array(
|
||||
'label' => t('HTML5'),
|
||||
'description' => t('This fieldgroup renders the inner content in a semantic HTML5 wrapper'),
|
||||
'instance_settings' => array('wrapper' => '', 'classes' => ''),
|
||||
'instance_settings' => array('wrapper' => '', 'classes' => '', 'id' => ''),
|
||||
),
|
||||
'fieldset' => array(
|
||||
'label' => t('Fieldset'),
|
||||
@ -452,7 +453,7 @@ function field_group_field_group_format_settings($group) {
|
||||
'#type' => 'select',
|
||||
'#options' => drupal_map_assoc($formatter['format_types']),
|
||||
'#default_value' => isset($group->format_settings['formatter']) ? $group->format_settings['formatter'] : $formatter['default_formatter'],
|
||||
'#weight' => 1,
|
||||
'#weight' => -4,
|
||||
);
|
||||
}
|
||||
|
||||
@ -470,7 +471,7 @@ function field_group_field_group_format_settings($group) {
|
||||
'#title' => t('ID'),
|
||||
'#type' => 'textfield',
|
||||
'#default_value' => isset($group->format_settings['instance_settings']['id']) ? $group->format_settings['instance_settings']['id'] : (isset($formatter['instance_settings']['id']) ? $formatter['instance_settings']['id'] : ''),
|
||||
'#weight' => 3,
|
||||
'#weight' => 10,
|
||||
'#element_validate' => array('field_group_validate_id'),
|
||||
);
|
||||
}
|
||||
@ -479,7 +480,7 @@ function field_group_field_group_format_settings($group) {
|
||||
'#title' => t('Extra CSS classes'),
|
||||
'#type' => 'textfield',
|
||||
'#default_value' => isset($group->format_settings['instance_settings']['classes']) ? $group->format_settings['instance_settings']['classes'] : (isset($formatter['instance_settings']['classes']) ? $formatter['instance_settings']['classes'] : ''),
|
||||
'#weight' => 4,
|
||||
'#weight' => 11,
|
||||
'#element_validate' => array('field_group_validate_css_class'),
|
||||
);
|
||||
}
|
||||
@ -501,9 +502,24 @@ function field_group_field_group_format_settings($group) {
|
||||
'#type' => 'textfield',
|
||||
'#default_value' => isset($group->format_settings['instance_settings']['element']) ? $group->format_settings['instance_settings']['element'] : $formatter['instance_settings']['element'],
|
||||
'#description' => t('E.g. div, section, aside etc.'),
|
||||
'#weight' => 1,
|
||||
);
|
||||
|
||||
$form['instance_settings']['show_label'] = array(
|
||||
'#title' => t('Show label'),
|
||||
'#type' => 'select',
|
||||
'#options' => array(0 => t('No'), 1 => t('Yes')),
|
||||
'#default_value' => isset($group->format_settings['instance_settings']['show_label']) ? $group->format_settings['instance_settings']['show_label'] : $formatter['instance_settings']['show_label'],
|
||||
'#weight' => 2,
|
||||
);
|
||||
|
||||
$form['instance_settings']['label_element'] = array(
|
||||
'#title' => t('Label element'),
|
||||
'#type' => 'textfield',
|
||||
'#default_value' => isset($group->format_settings['instance_settings']['label_element']) ? $group->format_settings['instance_settings']['label_element'] : $formatter['instance_settings']['label_element'],
|
||||
'#weight' => 3,
|
||||
);
|
||||
|
||||
$form['instance_settings']['attributes'] = array(
|
||||
'#title' => t('Attributes'),
|
||||
'#type' => 'textfield',
|
||||
@ -533,7 +549,7 @@ function field_group_field_group_format_settings($group) {
|
||||
'#type' => 'select',
|
||||
'#options' => array('none' => t('None'), 'blind' => t('Blind')),
|
||||
'#default_value' => isset($group->format_settings['instance_settings']['effect']) ? $group->format_settings['instance_settings']['effect'] : $formatter['instance_settings']['effect'],
|
||||
'#weight' => 2,
|
||||
'#weight' => 3,
|
||||
);
|
||||
$form['instance_settings']['speed'] = array(
|
||||
'#title' => t('Speed'),
|
||||
@ -617,7 +633,7 @@ function field_group_pre_render_prepare(&$group) {
|
||||
$classes = _field_group_get_html_classes($group);
|
||||
|
||||
$group->classes = implode(' ', $classes->required);
|
||||
$group->description = isset($group->format_settings['instance_settings']['description']) ? filter_xss_admin(t($group->format_settings['instance_settings']['description'])) : '';
|
||||
$group->description = !empty($group->format_settings['instance_settings']['description']) ? filter_xss_admin(t($group->format_settings['instance_settings']['description'])) : '';
|
||||
|
||||
}
|
||||
|
||||
@ -627,7 +643,7 @@ function field_group_pre_render_prepare(&$group) {
|
||||
* @param Array $elements by address.
|
||||
* @param Object $group The Field group info.
|
||||
*/
|
||||
function field_group_field_group_pre_render(& $element, &$group, & $form) {
|
||||
function field_group_field_group_pre_render(&$element, &$group, & $form) {
|
||||
|
||||
field_group_pre_render_prepare($group);
|
||||
|
||||
@ -640,10 +656,7 @@ function field_group_field_group_pre_render(& $element, &$group, & $form) {
|
||||
);
|
||||
|
||||
if (isset($group->format_settings['instance_settings']['id']) && !empty($group->format_settings['instance_settings']['id'])) {
|
||||
$element['#id'] = $group->format_settings['instance_settings']['id'];
|
||||
}
|
||||
else {
|
||||
$element['#id'] = $form['#entity_type'] . '_' . $form['#bundle'] . '_' . $view_mode . '_' . $group->group_name;
|
||||
$element['#id'] = drupal_html_id($group->format_settings['instance_settings']['id']);
|
||||
}
|
||||
|
||||
$element['#weight'] = $group->weight;
|
||||
@ -691,6 +704,8 @@ function field_group_pre_render_fieldset(&$element, $group, &$form) {
|
||||
*/
|
||||
function field_group_pre_render_html_element(&$element, $group, &$form) {
|
||||
$html_element = isset($group->format_settings['instance_settings']['element']) ? $group->format_settings['instance_settings']['element'] : 'div';
|
||||
$show_label = isset($group->format_settings['instance_settings']['show_label']) ? $group->format_settings['instance_settings']['show_label'] : 0;
|
||||
$label_element = isset($group->format_settings['instance_settings']['label_element']) ? $group->format_settings['instance_settings']['label_element'] : 'div';
|
||||
$attributes = isset($group->format_settings['instance_settings']['attributes']) ? ' ' . $group->format_settings['instance_settings']['attributes'] : '';
|
||||
$group->classes = trim($group->classes);
|
||||
|
||||
@ -715,6 +730,9 @@ function field_group_pre_render_html_element(&$element, $group, &$form) {
|
||||
$attributes = drupal_attributes($element_attributes);
|
||||
|
||||
$element['#prefix'] = '<' . $html_element . $attributes . '>';
|
||||
if ($show_label) {
|
||||
$element['#prefix'] .= '<' . $label_element . '><span>' . check_plain(t($group->label)) . '</span></' . $label_element . '>';
|
||||
}
|
||||
$element['#suffix'] = '</' . $html_element . '>';
|
||||
}
|
||||
|
||||
@ -733,18 +751,19 @@ function field_group_pre_render_div(&$element, $group, &$form) {
|
||||
$effect = isset($group->format_settings['instance_settings']['effect']) ? $group->format_settings['instance_settings']['effect'] : 'none';
|
||||
|
||||
$element['#type'] = 'markup';
|
||||
$id = isset($element['#id']) ? ' id="' . $element['#id'] . '"' : '';
|
||||
|
||||
if ($group->format_settings['formatter'] != 'open') {
|
||||
$element['#prefix'] = '<div class="' . $group->classes . '">
|
||||
|
||||
$element['#prefix'] = '<div' . $id . ' class="' . $group->classes . '">
|
||||
<' . $label_element . '><span class="field-group-format-toggler">' . check_plain(t($group->label)) . '</span></' . $label_element . '>
|
||||
<div class="field-group-format-wrapper" style="display: ' . (!empty($group->collapsed) ? 'none' : 'block') . ';">';
|
||||
$element['#suffix'] = '</div></div>';
|
||||
}
|
||||
else {
|
||||
$class_attribute = '';
|
||||
if (!empty($group->classes)) {
|
||||
$class_attribute = 'class = "' . $group->classes . '"';
|
||||
}
|
||||
$element['#prefix'] = '<div id="' . $element['#id'] . '"' . $class_attribute . '>';
|
||||
$class_attribute = !empty($group->classes) ? ' class="' . $group->classes . '"' : '';
|
||||
|
||||
$element['#prefix'] = '<div' . $id . $class_attribute . '>';
|
||||
if ($show_label) {
|
||||
$element['#prefix'] .= '<' . $label_element . '><span>' . check_plain(t($group->label)) . '</span></' . $label_element . '>';
|
||||
}
|
||||
@ -769,9 +788,11 @@ function field_group_pre_render_div(&$element, $group, &$form) {
|
||||
* @param $form The root element or form.
|
||||
*/
|
||||
function field_group_pre_render_html5(&$element, $group, &$form) {
|
||||
$id = !empty($element['#id']) ? ' id="' . $element['#id'] . '"' : '';
|
||||
$class = !empty($group->classes) ? ' class="' . $group->classes . '"' : '';
|
||||
$element += array(
|
||||
'#type' => 'markup',
|
||||
'#prefix' => '<' . $group->format_settings['instance_settings']['wrapper'] . ' id="' . $element['#id'] . '" class="' . $group->classes . '">',
|
||||
'#prefix' => '<' . $group->format_settings['instance_settings']['wrapper'] . $id . $class . '>',
|
||||
'#suffix' => '</' . $group->format_settings['instance_settings']['wrapper'] . '>',
|
||||
);
|
||||
}
|
||||
@ -1113,11 +1134,13 @@ function field_group_remove_empty_form_groups($name, & $element, $groups, &$form
|
||||
$hasChildren = FALSE;
|
||||
if (count($children)) {
|
||||
foreach ($children as $childname) {
|
||||
|
||||
if (in_array($childname, $groups)) {
|
||||
field_group_remove_empty_form_groups($childname, $element[$childname], $groups, $form_groups, $entity);
|
||||
}
|
||||
$exception = $entity . '__' . $childname;
|
||||
$hasChildren = $hasChildren ? TRUE : (isset($element[$childname]['#type']) || in_array($exception, $exceptions));
|
||||
$hasChildren = $hasChildren ? TRUE : (isset($element[$childname]['#type']) || isset($element[$childname]['#markup']) || in_array($exception, $exceptions));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1443,7 +1466,7 @@ function form_process_multipage($element, &$form_state) {
|
||||
'#default_value' => $element['#default_control'],
|
||||
'#attributes' => array('class' => array('multipage-active-control')),
|
||||
);
|
||||
|
||||
|
||||
return $element;
|
||||
}
|
||||
|
||||
@ -1566,8 +1589,10 @@ function field_group_info_groups($entity_type = NULL, $bundle = NULL, $view_mode
|
||||
$groups = $cached->data;
|
||||
}
|
||||
else {
|
||||
drupal_static_reset('ctools_export_load_object');
|
||||
drupal_static_reset('ctools_export_load_object_all');
|
||||
$ctools_export_load_object = &drupal_static('ctools_export_load_object');
|
||||
$ctools_export_load_object_all = &drupal_static('ctools_export_load_object_all');
|
||||
unset($ctools_export_load_object['field_group']);
|
||||
unset($ctools_export_load_object_all['field_group']);
|
||||
$groups = field_group_read_groups();
|
||||
cache_set('field_groups', $groups, 'cache_field');
|
||||
}
|
||||
@ -1680,7 +1705,7 @@ function field_group_exists($group_name, $entity_type, $bundle, $mode) {
|
||||
* Field group object.
|
||||
*/
|
||||
function field_group_unpack($packed_group) {
|
||||
if (!isset($packed_group->data)) {
|
||||
if (empty($packed_group->data)) {
|
||||
return $packed_group;
|
||||
}
|
||||
|
||||
@ -1847,7 +1872,7 @@ function field_group_attach_groups(&$element, $view_mode, $form_state = array())
|
||||
/**
|
||||
* Pre render callback for rendering groups.
|
||||
* @see field_group_field_attach_form
|
||||
* @param $element Form that is beïng rendered.
|
||||
* @param $element Form that is being rendered.
|
||||
*/
|
||||
function field_group_form_pre_render(&$element) {
|
||||
return field_group_build_entity_groups($element, 'form');
|
||||
@ -1860,7 +1885,7 @@ function field_group_form_pre_render(&$element) {
|
||||
* @see field_group_theme_registry_alter
|
||||
* @see field_group_fields_nest()
|
||||
* @param $vars preprocess vars or form element
|
||||
* @param $type The type of object beïng rendered
|
||||
* @param $type The type of object being rendered
|
||||
* @return $element Array with re-arranged fields in forms.
|
||||
*/
|
||||
function field_group_build_entity_groups(&$vars, $type) {
|
||||
@ -1890,8 +1915,13 @@ function field_group_build_entity_groups(&$vars, $type) {
|
||||
return $element;
|
||||
}
|
||||
|
||||
// No groups on the entity. Prerender removed empty field groups.
|
||||
if (empty($element['#fieldgroups'])) {
|
||||
return $element;
|
||||
}
|
||||
|
||||
// Put groups inside content if we are rendering an entity_view.
|
||||
foreach ($element['#groups'] as $group) {
|
||||
foreach ($element['#fieldgroups'] as $group) {
|
||||
if (!empty($element[$group->group_name]) && $type != 'user_profile') {
|
||||
$vars['content'][$group->group_name] = $element[$group->group_name];
|
||||
}
|
||||
@ -1914,7 +1944,7 @@ function field_group_build_entity_groups(&$vars, $type) {
|
||||
* @param Array $element
|
||||
* The current element to analyse for grouping.
|
||||
* @param Array $vars
|
||||
* Rendering vars from the entity beïng viewed.
|
||||
* Rendering vars from the entity being viewed.
|
||||
*/
|
||||
function field_group_fields_nest(&$element, &$vars = NULL) {
|
||||
|
||||
@ -1947,11 +1977,11 @@ function field_group_fields_nest(&$element, &$vars = NULL) {
|
||||
// Entity being viewed
|
||||
if ($vars) {
|
||||
// If not a group, check vars['content'] for empty field.
|
||||
if (!isset($element['#groups'][$child_name]) && isset($vars['content'][$child_name])) {
|
||||
if (!isset($element['#fieldgroups'][$child_name]) && isset($vars['content'][$child_name])) {
|
||||
$group_references[$parent_name][$child_name] = $vars['content'][$child_name];
|
||||
unset($vars['content'][$child_name]);
|
||||
}
|
||||
elseif (!isset($element['#groups'][$child_name]) && isset($vars['user_profile'][$child_name])) {
|
||||
elseif (!isset($element['#fieldgroups'][$child_name]) && isset($vars['user_profile'][$child_name])) {
|
||||
$group_references[$parent_name][$child_name] = $vars['user_profile'][$child_name];
|
||||
unset($vars['user_profile'][$child_name]);
|
||||
}
|
||||
|
@ -50,7 +50,8 @@ Drupal.behaviors.horizontalTabs = {
|
||||
if (!tab_focus) {
|
||||
// If the current URL has a fragment and one of the tabs contains an
|
||||
// element that matches the URL fragment, activate that tab.
|
||||
if (window.location.hash && window.location.hash !== '#' && $(window.location.hash, this).length) {
|
||||
var hash = window.location.hash.replace(/[=%;,\/]/g, "");
|
||||
if (hash !== '#' && $(hash, this).length) {
|
||||
tab_focus = $(window.location.hash, this).closest('.horizontal-tabs-pane');
|
||||
}
|
||||
else {
|
||||
|
@ -1,7 +1,7 @@
|
||||
(function ($) {
|
||||
|
||||
/**
|
||||
* This script transforms a set of wrappers into a stack of multipage pages.
|
||||
* This script transforms a set of wrappers into a stack of multipage pages.
|
||||
* Another pane can be entered by clicking next/previous.
|
||||
*
|
||||
*/
|
||||
@ -24,22 +24,22 @@ Drupal.behaviors.MultiPage = {
|
||||
|
||||
// Transform each div.multipage-pane into a multipage with controls.
|
||||
$panes.each(function () {
|
||||
|
||||
|
||||
$controls = $('<div class="multipage-controls-list clearfix"></div>');
|
||||
$(this).append($controls);
|
||||
|
||||
|
||||
// Check if the submit button needs to move to the latest pane.
|
||||
if (Drupal.settings.field_group.multipage_move_submit && $('.form-actions').length) {
|
||||
$('.form-actions', $form).remove().appendTo($($controls, $panes.last()));
|
||||
}
|
||||
|
||||
|
||||
var multipageControl = new Drupal.multipageControl({
|
||||
title: $('> .multipage-pane-title', this).text(),
|
||||
wrapper: $(this),
|
||||
has_next: $(this).next().length,
|
||||
has_previous: $(this).prev().length
|
||||
});
|
||||
|
||||
|
||||
$controls.append(multipageControl.item);
|
||||
$(this)
|
||||
.addClass('multipage-pane')
|
||||
@ -48,13 +48,14 @@ Drupal.behaviors.MultiPage = {
|
||||
if (this.id == focusID) {
|
||||
paneWithFocus = $(this);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
if (paneWithFocus === undefined) {
|
||||
// If the current URL has a fragment and one of the tabs contains an
|
||||
// element that matches the URL fragment, activate that tab.
|
||||
if (window.location.hash && window.location.hash !== '#' && $(window.location.hash, this).length) {
|
||||
var hash = window.location.hash.replace(/[=%;,\/]/g, "");
|
||||
if (hash !== '#' && $(hash, this).length) {
|
||||
paneWithFocus = $(window.location.hash, this).closest('.multipage-pane');
|
||||
}
|
||||
else {
|
||||
@ -85,12 +86,12 @@ Drupal.multipageControl = function (settings) {
|
||||
self.nextPage();
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
this.previousLink.click(function () {
|
||||
self.previousPage();
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
/*
|
||||
// Keyboard events added:
|
||||
// Pressing the Enter key will open the tab pane.
|
||||
@ -116,7 +117,7 @@ Drupal.multipageControl = function (settings) {
|
||||
};
|
||||
|
||||
Drupal.multipageControl.prototype = {
|
||||
|
||||
|
||||
/**
|
||||
* Displays the tab's content pane.
|
||||
*/
|
||||
@ -135,7 +136,7 @@ Drupal.multipageControl.prototype = {
|
||||
$('#active-multipage-control').remove();
|
||||
this.nextLink.after('<span id="active-multipage-control" class="element-invisible">' + Drupal.t('(active page)') + '</span>');
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Continues to the next page or step in the form.
|
||||
*/
|
||||
@ -143,7 +144,7 @@ Drupal.multipageControl.prototype = {
|
||||
this.wrapper.next().data('multipageControl').focus();
|
||||
$('html, body').scrollTop(this.wrapper.parents('.field-group-multipage-group-wrapper').offset().top);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Returns to the previous page or step in the form.
|
||||
*/
|
||||
@ -210,22 +211,22 @@ Drupal.theme.prototype.multipage = function (settings) {
|
||||
|
||||
var controls = {};
|
||||
controls.item = $('<span class="multipage-button"></span>');
|
||||
|
||||
|
||||
controls.previousLink = $('<input type="button" class="form-submit multipage-link-previous" value="" />');
|
||||
controls.previousTitle = Drupal.t('Previous page');
|
||||
controls.item.append(controls.previousLink.val(controls.previousTitle));
|
||||
|
||||
controls.item.append(controls.previousLink.val(controls.previousTitle));
|
||||
|
||||
controls.nextLink = $('<input type="button" class="form-submit multipage-link-next" value="" />');
|
||||
controls.nextTitle = Drupal.t('Next page');
|
||||
controls.item.append(controls.nextLink.val(controls.nextTitle));
|
||||
|
||||
|
||||
if (!settings.has_next) {
|
||||
controls.nextLink.hide();
|
||||
}
|
||||
if (!settings.has_previous) {
|
||||
controls.previousLink.hide();
|
||||
}
|
||||
|
||||
|
||||
return controls;
|
||||
};
|
||||
|
||||
@ -239,18 +240,18 @@ Drupal.FieldGroup.Effects = Drupal.FieldGroup.Effects || {};
|
||||
Drupal.FieldGroup.Effects.processMultipage = {
|
||||
execute: function (context, settings, type) {
|
||||
if (type == 'form') {
|
||||
|
||||
|
||||
var $firstErrorItem = false;
|
||||
|
||||
|
||||
// Add required fields mark to any element containing required fields
|
||||
$('div.multipage-pane').each(function(i){
|
||||
if ($('.error', $(this)).length) {
|
||||
|
||||
|
||||
// Save first error item, for focussing it.
|
||||
if (!$firstErrorItem) {
|
||||
$firstErrorItem = $(this).data('multipageControl');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Drupal.FieldGroup.setGroupWithfocus($(this));
|
||||
$(this).data('multipageControl').focus();
|
||||
}
|
||||
@ -260,7 +261,7 @@ Drupal.FieldGroup.Effects.processMultipage = {
|
||||
if ($firstErrorItem) {
|
||||
$firstErrorItem.focus();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,8 +13,8 @@ class GroupUITestCase extends DrupalWebTestCase {
|
||||
public static function getInfo() {
|
||||
return array(
|
||||
'name' => 'UI tests',
|
||||
'description' => 'Test the field group UI.',
|
||||
'group' => 'Field group',
|
||||
'description' => 'Test the Field Group UI.',
|
||||
'group' => 'Field Group',
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,13 @@
|
||||
name = "Fieldgroup Test"
|
||||
description = "Test module for fieldgroup"
|
||||
name = "Field Group Test"
|
||||
description = "Test module for Field Group"
|
||||
core = "7.x"
|
||||
package = "Fieldgroup"
|
||||
package = Fields
|
||||
hidden = TRUE
|
||||
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-09-25
|
||||
version = "7.x-1.3"
|
||||
; Information added by Drupal.org packaging script on 2014-06-04
|
||||
version = "7.x-1.4"
|
||||
core = "7.x"
|
||||
project = "field_group"
|
||||
datestamp = "1380124361"
|
||||
datestamp = "1401918529"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user