Commit 418be2be authored by Chris Shantz's avatar Chris Shantz
Browse files

Merge branch '1.0.x' into prod/1.0.x

parents de1b7c39 2a7d1431
......@@ -30,6 +30,8 @@ dependencies:
- media_library
- metatag
- path
- scheduler
- scheduler_content_moderation_integration
- smart_date
- term_reference_tree
- text
......@@ -344,6 +346,23 @@ content:
settings:
display_label: true
third_party_settings: { }
publish_on:
type: datetime_timestamp_no_default
weight: 30
region: content
settings: { }
third_party_settings: { }
publish_state:
type: scheduler_moderation
weight: 30
region: content
settings: { }
third_party_settings: { }
scheduler_settings:
weight: 20
settings: { }
third_party_settings: { }
region: content
status:
type: boolean_checkbox
weight: 8
......@@ -376,6 +395,18 @@ content:
size: 60
placeholder: ''
third_party_settings: { }
unpublish_on:
type: datetime_timestamp_no_default
weight: 30
region: content
settings: { }
third_party_settings: { }
unpublish_state:
type: scheduler_moderation
weight: 30
region: content
settings: { }
third_party_settings: { }
url_redirects:
weight: 18
region: content
......
......@@ -33,6 +33,12 @@ content:
size: 60
placeholder: ''
third_party_settings: { }
publish_on:
type: datetime_timestamp_no_default
weight: 30
region: content
settings: { }
third_party_settings: { }
status:
type: boolean_checkbox
settings:
......@@ -45,5 +51,11 @@ content:
settings: { }
third_party_settings: { }
region: content
unpublish_on:
type: datetime_timestamp_no_default
weight: 30
region: content
settings: { }
third_party_settings: { }
hidden:
path: true
......@@ -33,6 +33,12 @@ content:
size: 60
placeholder: ''
third_party_settings: { }
publish_on:
type: datetime_timestamp_no_default
weight: 30
region: content
settings: { }
third_party_settings: { }
status:
type: boolean_checkbox
settings:
......@@ -45,5 +51,11 @@ content:
settings: { }
third_party_settings: { }
region: content
unpublish_on:
type: datetime_timestamp_no_default
weight: 30
region: content
settings: { }
third_party_settings: { }
hidden:
path: true
......@@ -5,6 +5,7 @@ dependencies:
- entity_browser_block_layout
- menu_ui
- node_revision_delete
- scheduler
third_party_settings:
entity_browser_block_layout:
entity_browser_block_layout_view_modes:
......@@ -25,6 +26,19 @@ third_party_settings:
minimum_revisions_to_keep: 50
minimum_age_to_delete: 0
when_to_delete: 0
scheduler:
expand_fieldset: when_required
fields_display_mode: vertical_tab
publish_enable: true
publish_past_date: error
publish_past_date_created: false
publish_required: false
publish_revision: true
publish_touch: true
show_message_after_update: true
unpublish_enable: true
unpublish_required: false
unpublish_revision: true
name: Event
type: uw_ct_event
description: 'Events are gatherings or activities that that happen on a specific date (and optionally, time).'
......
name: UW Event
name: 'UW Event'
type: module
package: WCMS
core_version_requirement: '^8.9 || ^9'
......@@ -37,6 +37,8 @@ dependencies:
- 'drupal:user'
- 'drupal:views'
- 'drupal:views_autocomplete_filters'
- 'scheduler:scheduler'
- 'scheduler_content_moderation_integration:scheduler_content_moderation_integration'
- 'simple_sitemap:simple_sitemap'
- 'term_reference_tree:term_reference_tree'
- 'uw_cfg_common:uw_cfg_common'
......
......@@ -6,7 +6,6 @@
*/
use Drupal\Core\Form\FormStateInterface;
use Drupal\node\Entity\Node;
use Drupal\views\ViewExecutable;
/**
......@@ -116,24 +115,41 @@ function uw_ct_event_preprocess_views_view_unformatted(&$variables) {
$variables['view']->getDisplay()->display['id'] == 'event_page'
) {
// Services we are going to use.
$uwNodeContent = \Drupal::service('uw_cfg_common.uw_node_content');
$uwNodeFieldData = \Drupal::service('uw_cfg_common.uw_node_field_value');
// For each row, get the data out and the node data.
foreach ($variables['rows'] as $row) {
foreach ($variables['view']->result as $result) {
// Load the node.
$node = Node::load($row['content']['#node']->nid->value);
// Get the date value from the view.
$value = $result->node__field_uw_event_date_field_uw_event_date_value;
// Get the node data.
// Get the node, which is the entity of the result in the view.
$node = $result->_entity;
// Get all the dates from the node.
$dates = $node->field_uw_event_date->getValue();
// Load the node data using the node content service.
$node_data = $uwNodeContent->getNodeContent($node, 'teaser', 'all');
// Get the date info.
$date['value'] = $row['content']['#node']->node__field_uw_event_date_field_uw_event_date_value;
$date['end_value'] = $row['content']['#node']->node__field_uw_event_date_field_uw_event_date_end_value;
$date['duration'] = $row['content']['#node']->node__field_uw_event_date_field_uw_event_date_duration;
// Step through all the dates and once we find the
// date that is in the view, get the values from the
// node field data service.
foreach ($dates as $date) {
// If we find the date from the view, get the values
// from the node field data service.
if ($date['value'] == $value) {
// Set the date on the node data.
$node_data['date'] = [$uwNodeContent->getDate($date, 'event')];
// Get the date data and replace in the header.
$node_data['header']['date'] = [$uwNodeFieldData->getDate($date, 'event')];
// Break from the loop to save computational time.
break;
}
}
// Set a variable for the node data.
$variables['node_data'][] = $node_data;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment