diff options
7 files changed, 100 insertions, 16 deletions
diff --git a/features/timelinejs_feature/timelinejs_feature.features.field.inc b/features/timelinejs_feature/timelinejs_feature.features.field.inc index 831f89d..12b0bcf 100644 --- a/features/timelinejs_feature/timelinejs_feature.features.field.inc +++ b/features/timelinejs_feature/timelinejs_feature.features.field.inc @@ -616,6 +616,79 @@ function timelinejs_feature_field_default_fields() { ), ); + // Exported field: 'node-timeline-field_date_format'. + $fields['node-timeline-field_date_format'] = array( + 'field_config' => array( + 'active' => '1', + 'cardinality' => '1', + 'deleted' => '0', + 'entity_types' => array(), + 'field_name' => 'field_date_format', + 'foreign keys' => array( + 'format' => array( + 'columns' => array( + 'format' => 'format', + ), + 'table' => 'filter_format', + ), + ), + 'indexes' => array( + 'format' => array( + 0 => 'format', + ), + ), + 'locked' => '0', + 'module' => 'text', + 'settings' => array( + 'max_length' => '255', + ), + 'translatable' => '0', + 'type' => 'text', + ), + 'field_instance' => array( + 'bundle' => 'timeline', + 'default_value' => array( + 0 => array( + 'value' => '%Y,%m,%d', + ), + ), + 'deleted' => '0', + 'description' => 'Vide <a href="http://php.net/manual/en/function.strftime.php">strftime()</a>, deixe em branco em caso de dúvidas.', + 'display' => array( + 'default' => array( + 'label' => 'above', + 'module' => 'text', + 'settings' => array(), + 'type' => 'text_default', + 'weight' => 4, + ), + 'teaser' => array( + 'label' => 'above', + 'settings' => array(), + 'type' => 'hidden', + 'weight' => 0, + ), + ), + 'entity_type' => 'node', + 'field_name' => 'field_date_format', + 'label' => 'Formato de data', + 'required' => 0, + 'settings' => array( + 'text_processing' => '0', + 'user_register_form' => FALSE, + ), + 'widget' => array( + 'active' => 1, + 'module' => 'text', + 'settings' => array( + 'size' => '60', + ), + 'type' => 'text_textfield', + 'weight' => '5', + ), + ), + ); + // Exported field: 'node-timeline-field_image'. $fields['node-timeline-field_image'] = array( 'field_config' => array( @@ -782,13 +855,15 @@ function timelinejs_feature_field_default_fields() { // Included for use with string extractors like potx. t('Body'); t('Comment'); - t('Date'); - t('Embeded'); - t('Source'); + t('Data'); + t('Embarcado'); + t('Fonte'); + t('Formato de data'); + t('Imagem'); + t('Linha do tempo'); t('Optional source if the timeline is built using external data.'); - t('Image'); - t('Timeline'); t('Tag'); + t('Vide <a href="http://php.net/manual/en/function.strftime.php">strftime()</a>, deixe em branco em caso de dúvidas.'); return $fields; } diff --git a/features/timelinejs_feature/timelinejs_feature.features.inc b/features/timelinejs_feature/timelinejs_feature.features.inc index 748c3bd..80d1e19 100644 --- a/features/timelinejs_feature/timelinejs_feature.features.inc +++ b/features/timelinejs_feature/timelinejs_feature.features.inc @@ -28,7 +28,7 @@ function timelinejs_feature_node_info() { 'base' => 'node_content', 'description' => t('An event with a date.'), 'has_title' => '1', - 'title_label' => t('Title'), + 'title_label' => t('Título'), 'help' => '', ), 'timeline' => array( @@ -36,7 +36,7 @@ function timelinejs_feature_node_info() { 'base' => 'node_content', 'description' => t('A timeline is a set of events.'), 'has_title' => '1', - 'title_label' => t('Title'), + 'title_label' => t('Título'), 'help' => '', ), ); diff --git a/features/timelinejs_feature/timelinejs_feature.field_group.inc b/features/timelinejs_feature/timelinejs_feature.field_group.inc index 319b4b4..ef09be3 100644 --- a/features/timelinejs_feature/timelinejs_feature.field_group.inc +++ b/features/timelinejs_feature/timelinejs_feature.field_group.inc @@ -31,7 +31,7 @@ function timelinejs_feature_field_group_info() { 'label' => 'Mídia', 'instance_settings' => array( 'required_fields' => 1, - 'classes' => '', + 'classes' => ' group-media field-group-fieldset', 'description' => 'Escolha uma imagem um uma mídia a ser embarcada.', ), 'formatter' => 'collapsible', diff --git a/features/timelinejs_feature/timelinejs_feature.info b/features/timelinejs_feature/timelinejs_feature.info index 796e13c..73f4bde 100644 --- a/features/timelinejs_feature/timelinejs_feature.info +++ b/features/timelinejs_feature/timelinejs_feature.info @@ -14,6 +14,7 @@ dependencies[] = features dependencies[] = field_group dependencies[] = file dependencies[] = image +dependencies[] = isa_widgets_feature dependencies[] = options dependencies[] = strongarm dependencies[] = taxonomy @@ -29,6 +30,7 @@ features[field][] = node-event-field_embed features[field][] = node-event-field_image features[field][] = node-event-field_tag features[field][] = node-event-field_timeline +features[field][] = node-timeline-field_date_format features[field][] = node-timeline-field_image features[field][] = node-timeline-field_source features[field_group][] = group_media|node|evento|form diff --git a/features/timelinejs_feature/timelinejs_feature.strongarm.inc b/features/timelinejs_feature/timelinejs_feature.strongarm.inc index a95bc20..01479a4 100644 --- a/features/timelinejs_feature/timelinejs_feature.strongarm.inc +++ b/features/timelinejs_feature/timelinejs_feature.strongarm.inc @@ -190,7 +190,7 @@ function timelinejs_feature_strongarm() { 'weight' => '0', ), 'path' => array( - 'weight' => '5', + 'weight' => '6', ), ), 'display' => array(), diff --git a/timelinejs.module b/timelinejs.module index e6d5877..61b90fb 100644 --- a/timelinejs.module +++ b/timelinejs.module @@ -71,7 +71,7 @@ function timelinejs_theme($existing, $type, $theme, $path) { ), 'timelinejs_json_event' => array( 'template' => 'timelinejs_json_event', - 'variables' => array('event'), + 'variables' => array('event', 'date_format'), ), 'timelinejs_print' => array( 'template' => 'timelinejs_print', @@ -79,7 +79,7 @@ function timelinejs_theme($existing, $type, $theme, $path) { ), 'timelinejs_print_event' => array( 'template' => 'timelinejs_print_event', - 'variables' => array('event'), + 'variables' => array('event', 'date_format'), ), ); } @@ -115,9 +115,16 @@ function timelinejs_load_events($nid) { */ function timelinejs_fetch_items($nid, $format = 'json') { // Sanitization and basic data. - $nid = (int) $nid; - $timeline = node_load($nid); - $nodes = timelinejs_load_events($nid); + $nid = (int) $nid; + $timeline = node_load($nid); + $nodes = timelinejs_load_events($nid); + + if (isset($timeline->field_date_format['und'][0]['value'])) { + $date_format = $timeline->field_date_format['und'][0]['value']; + } + else { + $date_format = '%Y,%m,%d'; + } foreach ($nodes as $node) { $items[] = node_load($node->entity_id); @@ -135,7 +142,7 @@ function timelinejs_fetch_items($nid, $format = 'json') { $event->body['und'] = NULL; } - $output[] = theme('timelinejs_' . $format . '_event', array('event' => $event)); + $output[] = theme('timelinejs_' . $format . '_event', array('event' => $event, 'date_format' => $date_format)); if ($format == 'json') { $events = implode(',', $output); } diff --git a/timelinejs_json_event.tpl.php b/timelinejs_json_event.tpl.php index 75ab055..8a81c55 100644 --- a/timelinejs_json_event.tpl.php +++ b/timelinejs_json_event.tpl.php @@ -1,5 +1,5 @@ { - "startDate":"<?php print strftime('%Y,%m,%d', strtotime($event->field_date['und'][0]['value'])); ?>", + "startDate":"<?php print strftime($date_format, strtotime($event->field_date['und'][0]['value'])); ?>", "headline":"<?php print $event->title; ?>", "text":"<?php print timelinejs_strip($event->body['und'][0]['value']); ?>", <?php if (isset($event->field_tag) && isset($event->field_tag['und'][0]['value'])) { ?> |