more module updates

This commit is contained in:
Bachir Soussi Chiadmi
2015-04-20 18:02:17 +02:00
parent 37fbabab56
commit 7c85261e56
100 changed files with 6518 additions and 913 deletions

View File

@@ -1,6 +1,17 @@
Title 7.x-1.x, xxxx-xx-xx
-------------------------
#2286147 by plach: Language fallback does not work when an entity translation is
unpublished.
#2286145 by plach: Prevent empty translations from being synced into the legacy field.
#1772116 by duellj, GaëlG | f4o: Fixed Menu link title is not getting node title
by default.
#1779268 by ndobromirov | brycesenz: Undefined index: field_name in
title_field_views_data_alter().
#1441224 by MiroslavBanov | OPIN: Fieldgroup and Title break Manage Fields UI.
#1980520 by StoraH, pbz1912: Fixed Empty wrapper tags.
#1920096 by Johnny vd Laar | GiorgosK: Fixed Title incompatibility with the Term
reference widget
#1991712 by milesw: Fixed Title displays wrong revision using Revisioning
module.
#1907078 by sylus: Fixed Undefined index: field_name() in

View File

@@ -0,0 +1,13 @@
Title is built and maintained by the Drupal project community.
Everyone is encouraged to submit issues and changes (patches) to improve it, and
to contribute in other ways -- see http://drupal.org/contribute to find out how.
Project maintainers
-------------------
The Title maintainers oversee the development of the project as a whole. The project
maintainers for Title are:
- Francesco Placella 'plach' <http://drupal.org/u/plach>, branch 7.x-1.x
- Sam Becker 'Sam152' <https://www.drupal.org/u/sam152>, branch 8.x-2.x

View File

@@ -7,9 +7,9 @@ dependencies[] = title
dependencies[] = entity
dependencies[] = entity_translation
; Information added by drupal.org packaging script on 2013-07-24
version = "7.x-1.0-alpha7+5-dev"
; Information added by Drupal.org packaging script on 2015-03-23
version = "7.x-1.0-alpha7+14-dev"
core = "7.x"
project = "title"
datestamp = "1374690078"
datestamp = "1427069882"

View File

@@ -14,20 +14,16 @@ function title_form_field_ui_overview(&$form, &$form_state) {
if (!empty($entity_info['field replacement'])) {
$field_replacement_info = $entity_info['field replacement'];
$admin_path = _field_ui_bundle_admin_path($form['#entity_type'], $form['#bundle']);
$form['fields']['#header'][6]['colspan'] += 1;
foreach (element_children($form['fields']) as $field_name) {
if (isset($field_replacement_info[$field_name])) {
$form['fields'][$field_name]['field_replacement'] = array(
$form['fields'][$field_name]['delete'] = array(
'#type' => 'link',
'#title' => t('replace'),
'#href' => $admin_path . '/fields/replace/' . $field_name,
'#options' => array('attributes' => array('title' => t('Replace %field with a customizable field instance that can be translated.', array('%field' => $field_name)))),
);
}
else {
$form['fields'][$field_name]['field_replacement'] = array();
}
}
}
}

View File

@@ -98,35 +98,37 @@ function title_field_formatter_settings_summary($field, $instance, $view_mode) {
function title_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
$settings = $display['settings'];
$output = isset($items[0]) ? $items[0]['safe_value'] : '';
$element = array();
if (!empty($output) && $settings['title_link'] == 'content') {
$uri = entity_uri($entity_type, $entity);
$output = l($output, $uri['path'], array('html' => TRUE));
}
$wrap_tag = empty($settings['title_style']) ? '_none' : $settings['title_style'];
if ($wrap_tag != '_none') {
$variables = array(
'element' => array(
'#tag' => $wrap_tag,
'#value' => $output,
),
);
if (!empty($settings['title_class'])) {
$variables['element']['#attributes'] = array('class' => $settings['title_class']);
if (!empty($output)) {
if ($settings['title_link'] == 'content') {
$uri = entity_uri($entity_type, $entity);
$output = l($output, $uri['path'], array('html' => TRUE));
}
$output = theme('html_tag', $variables);
$wrap_tag = empty($settings['title_style']) ? '_none' : $settings['title_style'];
if ($wrap_tag != '_none') {
$variables = array(
'element' => array(
'#tag' => $wrap_tag,
'#value' => $output,
),
);
if (!empty($settings['title_class'])) {
$variables['element']['#attributes'] = array('class' => $settings['title_class']);
}
$output = theme('html_tag', $variables);
}
$element = array(
array(
'#markup' => $output,
),
);
}
$element = array(
array(
'#markup' => $output,
),
);
return $element;
}

View File

@@ -9,9 +9,9 @@ files[] = title.module
files[] = views/views_handler_title_field.inc
files[] = tests/title.test
; Information added by drupal.org packaging script on 2013-07-24
version = "7.x-1.0-alpha7+5-dev"
; Information added by Drupal.org packaging script on 2015-03-23
version = "7.x-1.0-alpha7+14-dev"
core = "7.x"
project = "title"
datestamp = "1374690078"
datestamp = "1427069882"

View File

@@ -218,6 +218,9 @@ function title_field_attach_load($entity_type, $entities, $age, $options) {
* replaced fields.
*/
function title_entity_load($entities, $type) {
// Load entity translations otherwise field language will not be computed
// correctly.
module_invoke('entity_translation', 'entity_load', $entities, $type);
foreach ($entities as &$entity) {
// Synchronize values from the regular field unless we are intializing it.
title_entity_sync($type, $entity, NULL, !empty($GLOBALS['title_field_replacement_init']));
@@ -487,8 +490,14 @@ function title_field_sync_get($entity_type, $entity, $legacy_field, $info, $lang
$langcode = field_language($entity_type, $entity, $info['field']['field_name'], $langcode);
$values = $info['callbacks']['sync_get']($entity_type, $entity, $legacy_field, $info, $langcode);
foreach ($values as $name => $value) {
$entity->{$name} = $value;
if ($value !== NULL) {
$entity->{$name} = $value;
}
}
// Ensure we do not pollute field language static cache.
$cache = &drupal_static('field_language');
list($id, ,) = entity_extract_ids($entity_type, $entity);
unset($cache[$entity_type][$id]);
}
}
@@ -584,6 +593,11 @@ function title_field_attach_form($entity_type, $entity, &$form, &$form_state, $l
if (isset($form[$legacy_field]['#access'])) {
$form[$info['field']['field_name']]['#access'] = $form[$legacy_field]['#access'];
}
// Add class from legacy field so behaviors can still be applied on
// title widget.
$form[$info['field']['field_name']]['#attributes']['class'] = array('form-item-' . $legacy_field);
// Restrict access to the legacy field form element and mark it as
// replaced.
$form[$legacy_field]['#access'] = FALSE;
@@ -952,3 +966,38 @@ function title_field_attach_create_bundle($entity_type, $bundle) {
}
}
}
/**
* Implements hook_field_info_alter().
*/
function title_field_info_alter(&$info) {
$supported_types = array('taxonomy_term_reference' => TRUE);
foreach ($info as $field_type => &$field_type_info) {
if (isset($supported_types[$field_type])) {
if (!isset($field_type_info['settings'])) {
$field_type_info['settings'] = array();
}
$field_type_info['settings'] += array('options_list_callback' => 'title_taxonomy_allowed_values');
}
}
}
/**
* Return taxonomy term values for taxonomy reference fields.
*/
function title_taxonomy_allowed_values($field) {
$bundle = !empty($field['settings']['allowed_values'][0]['vocabulary']) ? $field['settings']['allowed_values'][0]['vocabulary'] : NULL;
if ($bundle && ($label = title_field_replacement_get_label_field('taxonomy_term', $bundle))) {
$options = array();
foreach ($field['settings']['allowed_values'] as $tree) {
$vocabulary = taxonomy_vocabulary_machine_name_load($tree['vocabulary']);
if ($vocabulary && ($terms = taxonomy_get_tree($vocabulary->vid, $tree['parent'], NULL, TRUE))) {
foreach ($terms as $term) {
$options[$term->tid] = str_repeat('-', $term->depth) . entity_label('taxonomy_term', $term);
}
}
}
return $options;
}
return taxonomy_allowed_values($field);
}

View File

@@ -9,10 +9,12 @@ function title_field_views_data_alter(&$data) {
$replacements = title_field_replacement_info($entity_type);
if ($replacements) {
foreach ($replacements as $replacement) {
$field = field_info_field($replacement['field']['field_name']);
$table = _field_sql_storage_tablename($field);
if (isset($data[$table][$field['field_name']])) {
$data[$table][$field['field_name']]['field']['handler'] = 'views_handler_title_field';
if (isset($replacement['field']['field_name'])) {
$field = field_info_field($replacement['field']['field_name']);
$table = _field_sql_storage_tablename($field);
if (isset($data[$table][$field['field_name']])) {
$data[$table][$field['field_name']]['field']['handler'] = 'views_handler_title_field';
}
}
}
}