Skip to content
Snippets Groups Projects
Commit 0361cd27 authored by Liam Morland's avatar Liam Morland
Browse files

Merge branch 'feature/ISTWCMS-4532-l26yan-Add-map-link-field-to-event-content-type' into '8.x-1.x'

Feature/istwcms 4532 l26yan add map link field to event content type

See merge request !8
parents 4f43cc6a 58fb8d25
No related branches found
No related tags found
1 merge request!8Feature/istwcms 4532 l26yan add map link field to event content type
...@@ -8,6 +8,7 @@ dependencies: ...@@ -8,6 +8,7 @@ dependencies:
- field.field.node.uw_ct_event.field_uw_event_listing_page_img - field.field.node.uw_ct_event.field_uw_event_listing_page_img
- field.field.node.uw_ct_event.field_uw_event_location_address - field.field.node.uw_ct_event.field_uw_event_location_address
- field.field.node.uw_ct_event.field_uw_event_location_coord - field.field.node.uw_ct_event.field_uw_event_location_coord
- field.field.node.uw_ct_event.field_uw_event_map
- field.field.node.uw_ct_event.field_uw_event_summary - field.field.node.uw_ct_event.field_uw_event_summary
- field.field.node.uw_ct_event.field_uw_event_tags - field.field.node.uw_ct_event.field_uw_event_tags
- field.field.node.uw_ct_event.field_uw_event_type - field.field.node.uw_ct_event.field_uw_event_type
...@@ -63,6 +64,7 @@ third_party_settings: ...@@ -63,6 +64,7 @@ third_party_settings:
children: children:
- field_uw_event_location_address - field_uw_event_location_address
- field_uw_event_location_coord - field_uw_event_location_coord
- field_uw_event_map
parent_name: '' parent_name: ''
weight: 13 weight: 13
format_type: fieldset format_type: fieldset
...@@ -182,6 +184,14 @@ content: ...@@ -182,6 +184,14 @@ content:
third_party_settings: { } third_party_settings: { }
type: geofield_map type: geofield_map
region: content region: content
field_uw_event_map:
type: link_default
weight: 32
region: content
settings:
placeholder_url: ''
placeholder_title: ''
third_party_settings: { }
field_uw_event_summary: field_uw_event_summary:
weight: 10 weight: 10
settings: settings:
......
...@@ -9,6 +9,7 @@ dependencies: ...@@ -9,6 +9,7 @@ dependencies:
- field.field.node.uw_ct_event.field_uw_event_listing_page_img - field.field.node.uw_ct_event.field_uw_event_listing_page_img
- field.field.node.uw_ct_event.field_uw_event_location_address - field.field.node.uw_ct_event.field_uw_event_location_address
- field.field.node.uw_ct_event.field_uw_event_location_coord - field.field.node.uw_ct_event.field_uw_event_location_coord
- field.field.node.uw_ct_event.field_uw_event_map
- field.field.node.uw_ct_event.field_uw_event_summary - field.field.node.uw_ct_event.field_uw_event_summary
- field.field.node.uw_ct_event.field_uw_event_tags - field.field.node.uw_ct_event.field_uw_event_tags
- field.field.node.uw_ct_event.field_uw_event_type - field.field.node.uw_ct_event.field_uw_event_type
...@@ -546,5 +547,6 @@ content: ...@@ -546,5 +547,6 @@ content:
third_party_settings: { } third_party_settings: { }
region: content region: content
hidden: hidden:
field_uw_event_map: true
langcode: true langcode: true
layout_builder__layout: true layout_builder__layout: true
...@@ -9,6 +9,7 @@ dependencies: ...@@ -9,6 +9,7 @@ dependencies:
- field.field.node.uw_ct_event.field_uw_event_listing_page_img - field.field.node.uw_ct_event.field_uw_event_listing_page_img
- field.field.node.uw_ct_event.field_uw_event_location_address - field.field.node.uw_ct_event.field_uw_event_location_address
- field.field.node.uw_ct_event.field_uw_event_location_coord - field.field.node.uw_ct_event.field_uw_event_location_coord
- field.field.node.uw_ct_event.field_uw_event_map
- field.field.node.uw_ct_event.field_uw_event_summary - field.field.node.uw_ct_event.field_uw_event_summary
- field.field.node.uw_ct_event.field_uw_event_tags - field.field.node.uw_ct_event.field_uw_event_tags
- field.field.node.uw_ct_event.field_uw_event_type - field.field.node.uw_ct_event.field_uw_event_type
...@@ -48,6 +49,7 @@ hidden: ...@@ -48,6 +49,7 @@ hidden:
field_uw_event_host: true field_uw_event_host: true
field_uw_event_location_address: true field_uw_event_location_address: true
field_uw_event_location_coord: true field_uw_event_location_coord: true
field_uw_event_map: true
field_uw_event_tags: true field_uw_event_tags: true
field_uw_event_type: true field_uw_event_type: true
field_uw_event_website: true field_uw_event_website: true
......
langcode: en
status: true
dependencies:
config:
- field.storage.node.field_uw_event_map
- node.type.uw_ct_event
module:
- link
- require_on_publish
third_party_settings:
require_on_publish:
require_on_publish: false
id: node.uw_ct_event.field_uw_event_map
field_name: field_uw_event_map
entity_type: node
bundle: uw_ct_event
label: Map
description: 'Optional: provide a link to a map with the event location (e.g. https://uwaterloo.ca/map/)'
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings:
link_type: 16
title: 0
field_type: link
langcode: en
status: true
dependencies:
module:
- link
- node
id: node.field_uw_event_map
field_name: field_uw_event_map
entity_type: node
type: link
settings: { }
module: link
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false
<?php
namespace Drupal\uw_ct_event\EventSubscriber;
use Drupal\field_event_dispatcher\Event\Field\WidgetFormAlterEvent;
use Drupal\hook_event_dispatcher\HookEventDispatcherInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
/**
* Class UwEventEventSubscriber.
*
* UW event event subscriber.
*
* @package Drupal\uw_ct_event\EventSubscriber
*/
class UwEventEventSubscriber implements EventSubscriberInterface {
/**
* Alter widget form.
*
* Remove 'This must be an external URL such as http://example.com' from the
* link field.
*
* @param \Drupal\field_event_dispatcher\Event\Field\WidgetFormAlterEvent $event
* The event.
*/
public function alterWidgetForm(WidgetFormAlterEvent $event): void {
$element = &$event->getElement();
// Only modify element 'Map' (field_uw_event_map).
if (isset($element['#title']) && $element['#title'] == "Map") {
$context = $event->getContext();
// When creating or editing an event node,
// remove 'This must be an external URL such as
// http://example.com' from the link field.
$forms = [
'node-uw-ct-event-form',
'node-uw-ct-event-edit-form',
];
if (in_array($context['form']['#attributes']['class'][0], $forms)) {
unset($element['uri']['#description']['#items'][1]);
}
}
}
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents() {
return [
HookEventDispatcherInterface::WIDGET_FORM_ALTER => 'alterWidgetForm',
];
}
}
services:
uw_ct_event.event_subscriber:
class: '\Drupal\uw_ct_event\EventSubscriber\UwEventEventSubscriber'
tags:
- { name: 'event_subscriber' }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment