Commit a3351147 authored by Chris Shantz's avatar Chris Shantz
Browse files

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

parents 7e6b9dfb 0d707bd3
......@@ -2,7 +2,6 @@ langcode: en
status: true
dependencies:
config:
- core.base_field_override.node.uw_ct_event.title
- field.field.node.uw_ct_event.field_uw_audience
- field.field.node.uw_ct_event.field_uw_event_cost
- field.field.node.uw_ct_event.field_uw_event_date
......@@ -36,95 +35,6 @@ third_party_settings:
allow_custom: true
enabled: true
sections:
-
layout_id: uw_1_column
layout_settings:
label: ''
layout_builder_styles_style: uw_lbs_contained_width
layout_builder_id: ''
components:
1ba4b322-8a7a-477d-92d3-df2123766273:
uuid: 1ba4b322-8a7a-477d-92d3-df2123766273
region: first
configuration:
id: 'field_block:node:uw_ct_event:field_uw_event_date'
label: 'Date and time'
provider: layout_builder
label_display: '0'
formatter:
label: hidden
type: smartdate_default
settings:
timezone_override: ''
format: default
force_chronological: false
third_party_settings:
fences:
fences_field_tag: none
fences_field_classes: ''
fences_field_item_tag: none
fences_field_item_classes: ''
fences_label_tag: none
fences_label_classes: ''
context_mapping:
entity: layout_builder.entity
view_mode: view_mode
additional:
layout_builder_id: ''
weight: 0
edcdcadd-ffbb-44e1-a1d7-ae5474d0e1b8:
uuid: edcdcadd-ffbb-44e1-a1d7-ae5474d0e1b8
region: first
configuration:
id: 'field_block:node:uw_ct_event:title'
label: Title
provider: layout_builder
label_display: '0'
formatter:
label: hidden
type: string
settings:
link_to_entity: false
third_party_settings:
fences:
fences_field_tag: none
fences_field_classes: ''
fences_field_item_tag: none
fences_field_item_classes: ''
fences_label_tag: none
fences_label_classes: ''
context_mapping:
entity: layout_builder.entity
view_mode: view_mode
additional:
layout_builder_id: ''
weight: 1
91e3aae6-f8ef-45a3-9a8a-dbff5d0a14b8:
uuid: 91e3aae6-f8ef-45a3-9a8a-dbff5d0a14b8
region: first
configuration:
label_display: '0'
context_mapping:
entity: layout_builder.entity
id: 'field_block:node:uw_ct_event:field_uw_audience'
formatter:
label: above
settings:
link: true
third_party_settings: { }
type: entity_reference_label
additional: { }
weight: 2
third_party_settings:
layout_builder_lock:
lock:
1: 1
2: 2
3: 3
4: 4
5: 5
6: 6
8: 8
-
layout_id: uw_1_column
layout_settings:
......@@ -366,50 +276,6 @@ third_party_settings:
layout_builder_id: ''
weight: 12
third_party_settings: { }
-
layout_id: uw_1_column
layout_settings:
label: ''
layout_builder_styles_style: uw_lbs_contained_width
layout_builder_id: ''
components:
8663f91e-e7eb-49bf-9ad9-eb6e8a7693b6:
uuid: 8663f91e-e7eb-49bf-9ad9-eb6e8a7693b6
region: first
configuration:
id: 'field_block:node:uw_ct_event:field_uw_event_tags'
label: 'Event tag(s)'
provider: layout_builder
label_display: '0'
formatter:
label: hidden
type: entity_reference_label
settings:
link: true
third_party_settings:
fences:
fences_field_tag: none
fences_field_classes: ''
fences_field_item_tag: none
fences_field_item_classes: ''
fences_label_tag: none
fences_label_classes: ''
context_mapping:
entity: layout_builder.entity
view_mode: view_mode
additional:
layout_builder_id: ''
weight: 0
third_party_settings:
layout_builder_lock:
lock:
1: 1
2: 2
3: 3
4: 4
5: 5
7: 7
8: 8
layout_builder_restrictions:
entity_view_mode_restriction:
allowed_blocks:
......
......@@ -89,7 +89,7 @@ display:
is_secondary: false
select_all_none: true
select_all_none_nested: false
display_inline: 0
display_inline: false
field_uw_event_tags_target_id:
plugin_id: bef
advanced:
......@@ -99,7 +99,7 @@ display:
is_secondary: false
select_all_none: true
select_all_none_nested: false
display_inline: 0
display_inline: false
field_uw_audience_target_id:
plugin_id: bef
advanced:
......@@ -109,7 +109,7 @@ display:
is_secondary: false
select_all_none: true
select_all_none_nested: false
display_inline: 0
display_inline: false
pager:
type: some
options:
......@@ -656,7 +656,8 @@ display:
display_title: 'Event listing (block)'
position: 3
display_options:
display_extenders: { }
display_extenders:
metatag_display_extender: { }
display_description: ''
title: 'Event listing'
defaults:
......@@ -860,12 +861,10 @@ display:
type: default
options: { }
row:
type: fields
type: 'entity:node'
options:
default_field_elements: true
inline: { }
separator: ''
hide_empty: false
relationship: none
view_mode: teaser
fields:
title:
id: title
......
......@@ -5,6 +5,9 @@
* Install, update and uninstall for event content type.
*/
use Drupal\node\Entity\Node;
use Drupal\taxonomy\Entity\Term;
/**
* Implements hook_install().
*/
......@@ -29,13 +32,6 @@ function uw_ct_event_install() {
}
}
/**
* @file
* Contains various helper functions.
*/
use Drupal\taxonomy\Entity\Term;
/**
* Helper function to create a taxonomy term programmatically.
*
......@@ -72,3 +68,83 @@ function _uw_ct_event_term_create($term, $vocabulary, array $parent = []) {
// Return the taxonomy term id.
return $new_term->id();
}
/**
* Removes the first and last section from events.
*/
function uw_ct_event_update_8101(&$sandbox) {
// Get all the nids for blogs.
$nids = \Drupal::entityQuery('node')->condition('type', 'uw_ct_event')->execute();
// Load all the blog nodes.
$nodes = Node::loadMultiple($nids);
// Step through each of the nodes and remove the sections
// that were locked in fields before. This will only remove
// the layouts for the current revision.
foreach ($nodes as $node) {
// Load the sections.
$sections = $node->get('layout_builder__layout')->getSections();
// If the node has at least 3 sections, remove the
// first and last.
if (count($sections) > 2) {
// Remove first and last section.
unset($sections[0]);
unset($sections[count($sections)]);
// Set the updated sections.
$node->layout_builder__layout->setValue($sections);
// Save the node.
$node->save();
}
// Get the node id from the node object.
$nid = $node->id();
// Get all the revisions for the nid.
$query = \Drupal::database()->select('node_revision', 'nr');
$query->addField('nr', 'vid');
$query->condition('nr.nid', $nid);
$revisions = $query->execute()->fetchAll();
// Step through each of the revisions and remove the sections.
foreach ($revisions as $revision) {
// Get the vid.
$vid = $revision->vid;
// Get all the sections for the revision.
$query = \Drupal::database()->select('node_revision__layout_builder__layout', 'nrlbl');
$query->addField('nrlbl', 'layout_builder__layout_section');
$query->condition('nrlbl.entity_id', $nid);
$query->condition('nrlbl.revision_id', $vid);
$sections = $query->execute()->fetchAll();
// If the sections are not empty, remove first and last.
if (!empty($sections)) {
// Get the last section.
$last = count($sections) - 1;
// Delete the first section.
$query = \Drupal::database()->delete('node_revision__layout_builder__layout');
$query->condition('entity_id', $nid);
$query->condition('revision_id', $vid);
$query->condition('delta', 0);
$query->execute();
// Delete the last section.
$query = \Drupal::database()->delete('node_revision__layout_builder__layout');
$query->condition('entity_id', $nid);
$query->condition('revision_id', $vid);
$query->condition('delta', $last);
$query->execute();
}
}
}
}
......@@ -5,16 +5,17 @@
* Provides configuration and settings for events.
*/
use Drupal\views\ViewExecutable;
/**
* Implements hook_preprocess_block().
*
* Remove the exposed widgets from the view/block for events.
* Implements hook_views_pre_render().
*/
function uw_ct_event_preprocess_block($variables) {
// If we are on a events listing, remove the exposed widgets.
if (isset($variables['derivative_plugin_id']) && $variables['derivative_plugin_id'] == 'uw_view_events-events_listing_block') {
// Remove the exposed widgets from the view/block.
unset($variables['content']['#view']->exposed_widgets);
function uw_ct_event_views_pre_render(ViewExecutable $view) {
// Remove exposed filters on block listing view.
if ($view->id() == 'uw_view_events' &&
$view->getTitle() == 'Event listing') {
unset($view->exposed_widgets);
}
}
......@@ -27,26 +28,3 @@ function uw_ct_event_geofield_map_latlon_element_alter(array &$map_settings, arr
$complete_form['#attached']['library'][] = 'uw_ct_event/uw_ct_event_edit';
}
}
/**
* Implements hook_preprocess_node().
*
* Set variables for teaser.
*/
function uw_ct_event_preprocess_node(&$variables) {
// If we are on a event node that is a teaser,
// get out the variables to be used in pattern-lab.
if ($variables['node']->getType() == 'uw_ct_event' && $variables['view_mode'] == 'teaser') {
// The UW service object.
$uwService = \Drupal::service('uw_cfg_common.uw_service');
// Get the teaser variables.
$variables['teaser'] = $uwService->uwGetNodeContent($variables['node'], 'teaser', 'all');
// Unset the content variable, so that we do not get
// a second print of all the content.
unset($variables['content']);
}
}
Markdown is supported
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