Skip to content

Commit

Permalink
NEPT-1813: Improve platform feature (#1894)
Browse files Browse the repository at this point in the history
* NEPT-1813: Improve the node loading in the survey analysis page.

* NEPT-1813: Improve the display of selected values of a selectbox in a translated content.

* NEPT-1813: Improve the link path generation of the block carousel.

* NEPT-1813: Upgrade ec_resp to 2.3.6 that includes the "easy breadcrumb" patch.
  • Loading branch information
gillesdeudon committed Mar 27, 2018
1 parent 9a3eab7 commit 1660732
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
Expand Up @@ -338,7 +338,7 @@ function multisite_block_carousel_contents($delta) {
switch ($item['type']) {
case 'image':
$thumb = image_style_url('landscape', $item['uri']);
$return .= '<a href="' . $path . '">';
$return .= '<a href="' . check_plain($path) . '">';
$return .= '<img src="' . $thumb . '" alt="' . check_plain($item['filename']) . '" />';
$return .= '<p class="carousel-caption">' . (isset($item['field_picture_description'][LANGUAGE_NONE][0]['safe_value']) ? filter_xss($item['field_picture_description'][LANGUAGE_NONE][0]['safe_value']) : check_plain($item['filename'])) . '</p>';
$return .= '</a>';
Expand Down
Expand Up @@ -586,15 +586,17 @@ function nexteuropa_multilingual_preprocess_field(&$variables) {

// Translate label.
if (!empty($variables['label'])) {
$variables['label'] = i18n_field_translate_property($instance, 'label', $lang);
// Use "check_plain" function to secure the label value like the "field"
// module does.
$variables['label'] = check_plain(i18n_field_translate_property($instance, 'label', $lang));
}
// Translate field value (for select list field).
if ($field['type'] == 'list_text' && $translated_value = i18n_field_translate_allowed_values($field, $lang)) {
foreach ($variables['items'] as $key => $item) {
// Get key of the value.
$key_value = $element['#items'][$key]['value'];
// Get translated field value.
$variables['items'][$key]['#markup'] = $translated_value[$key_value];
$variables['items'][$key]['#markup'] = field_filter_xss($translated_value[$key_value]);
}
}
}
Expand Down
Expand Up @@ -28,11 +28,12 @@ function survey_core_node_view($node, $view_mode, $langcode) {
*/
function survey_core_menu() {
$items = array();
$items['survey_analysis/%'] = array(
$items['survey_analysis/%node'] = array(
'title' => 'Analysis',
'page callback' => 'survey_analysis',
'page arguments' => array(1),
'access callback' => TRUE,
'access callback' => 'webform_results_access',
'access arguments' => array(1),
'weight' => 5,
);

Expand All @@ -42,9 +43,18 @@ function survey_core_menu() {

/**
* Display analysis results of a webform.
*
* @param mixed $node
* The nid or the object of the node to which the webform is attached.
*
* @return string
* The survey analysis page to display.
*/
function survey_analysis($nid) {
$node = node_load($nid);
function survey_analysis($node) {
if (!is_object($node)) {
$node = node_load($node);
}

$sids = array();
$components = $node->webform['components'];
$data = array();
Expand Down
2 changes: 1 addition & 1 deletion resources/multisite_drupal_standard.make
Expand Up @@ -1033,7 +1033,7 @@ libraries[respond][download][url] = https://raw.githubusercontent.com/scottjehl/
projects[ec_resp][type] = theme
projects[ec_resp][download][type] = git
projects[ec_resp][download][url] = https://github.com/ec-europa/ec_resp.git
projects[ec_resp][download][tag] = 2.3.5
projects[ec_resp][download][tag] = 2.3.6

projects[atomium][type] = theme
projects[atomium][version] = 2.7
Expand Down

0 comments on commit 1660732

Please sign in to comment.