Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
WCMS
uw_ct_event
Commits
02716f20
Commit
02716f20
authored
Jul 20, 2021
by
Chris Shantz
Browse files
Merge branch '1.0.x' into prod/1.0.x
parents
300e57ec
9f6edf6f
Changes
7
Hide whitespace changes
Inline
Side-by-side
config/install/core.entity_form_display.node.uw_ct_event.default.yml
View file @
02716f20
...
...
@@ -14,6 +14,7 @@ dependencies:
-
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_website
-
field.field.node.uw_ct_event.field_uw_hero_image
-
field.field.node.uw_ct_event.field_uw_meta_description
-
field.field.node.uw_ct_event.field_uw_meta_image
-
field.field.node.uw_ct_event.field_uw_meta_tags
...
...
@@ -39,7 +40,7 @@ third_party_settings:
-
field_uw_event_type
-
field_uw_event_tags
parent_name
:
'
'
weight
:
20
weight
:
15
format_type
:
fieldset
format_settings
:
id
:
'
'
...
...
@@ -54,7 +55,7 @@ third_party_settings:
-
field_uw_event_website
-
field_uw_event_cost
parent_name
:
'
'
weight
:
1
2
weight
:
1
3
format_type
:
fieldset
format_settings
:
id
:
'
'
...
...
@@ -69,7 +70,7 @@ third_party_settings:
-
field_uw_event_location_coord
-
field_uw_event_map
parent_name
:
'
'
weight
:
1
6
weight
:
1
4
format_type
:
fieldset
region
:
content
format_settings
:
...
...
@@ -84,7 +85,7 @@ third_party_settings:
-
field_uw_meta_image
-
field_uw_meta_tags
parent_name
:
'
'
weight
:
24
weight
:
16
format_type
:
fieldset
region
:
content
format_settings
:
...
...
@@ -100,7 +101,7 @@ mode: default
content
:
created
:
type
:
datetime_timestamp
weight
:
1
1
weight
:
1
2
region
:
content
settings
:
{
}
third_party_settings
:
{
}
...
...
@@ -207,7 +208,7 @@ content:
placeholder_title
:
'
'
third_party_settings
:
{
}
field_uw_event_summary
:
weight
:
1
0
weight
:
1
1
settings
:
rows
:
5
placeholder
:
'
'
...
...
@@ -245,6 +246,13 @@ content:
third_party_settings
:
{
}
type
:
link_default
region
:
content
field_uw_hero_image
:
weight
:
10
settings
:
media_types
:
{
}
third_party_settings
:
{
}
type
:
media_library_widget
region
:
content
field_uw_meta_description
:
weight
:
25
settings
:
...
...
@@ -331,7 +339,7 @@ content:
region
:
content
third_party_settings
:
{
}
url_redirects
:
weight
:
50
weight
:
17
region
:
content
settings
:
{
}
third_party_settings
:
{
}
...
...
config/install/core.entity_view_display.node.uw_ct_event.default.yml
View file @
02716f20
...
...
@@ -14,6 +14,7 @@ dependencies:
-
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_website
-
field.field.node.uw_ct_event.field_uw_hero_image
-
field.field.node.uw_ct_event.field_uw_meta_description
-
field.field.node.uw_ct_event.field_uw_meta_image
-
field.field.node.uw_ct_event.field_uw_meta_tags
...
...
@@ -428,6 +429,14 @@ content:
third_party_settings
:
{
}
type
:
link
region
:
content
field_uw_hero_image
:
weight
:
118
label
:
above
settings
:
link
:
true
third_party_settings
:
{
}
type
:
entity_reference_label
region
:
first
field_uw_meta_description
:
weight
:
115
label
:
above
...
...
config/install/core.entity_view_display.node.uw_ct_event.teaser.yml
View file @
02716f20
...
...
@@ -15,6 +15,7 @@ dependencies:
-
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_website
-
field.field.node.uw_ct_event.field_uw_hero_image
-
field.field.node.uw_ct_event.field_uw_meta_description
-
field.field.node.uw_ct_event.field_uw_meta_image
-
field.field.node.uw_ct_event.field_uw_meta_tags
...
...
@@ -55,6 +56,7 @@ hidden:
field_uw_event_tags
:
true
field_uw_event_type
:
true
field_uw_event_website
:
true
field_uw_hero_image
:
true
field_uw_meta_description
:
true
field_uw_meta_image
:
true
field_uw_meta_tags
:
true
...
...
config/install/field.field.node.uw_ct_event.field_uw_event_location_address.yml
View file @
02716f20
...
...
@@ -14,21 +14,7 @@ label: 'Location address'
description
:
'
'
required
:
false
translatable
:
false
default_value
:
-
country_code
:
CA
langcode
:
'
'
given_name
:
'
'
family_name
:
'
'
organization
:
'
'
address_line1
:
'
'
address_line2
:
'
'
locality
:
'
'
administrative_area
:
'
ON'
postal_code
:
'
'
additional_name
:
null
sorting_code
:
null
dependent_locality
:
null
default_value
:
{
}
default_value_callback
:
'
'
settings
:
available_countries
:
{
}
...
...
config/install/field.field.node.uw_ct_event.field_uw_hero_image.yml
0 → 100644
View file @
02716f20
langcode
:
en
status
:
true
dependencies
:
config
:
-
field.storage.node.field_uw_hero_image
-
media.type.uw_mt_image
-
node.type.uw_ct_event
module
:
-
require_on_publish
third_party_settings
:
require_on_publish
:
require_on_publish
:
false
id
:
node.uw_ct_event.field_uw_hero_image
field_name
:
field_uw_hero_image
entity_type
:
node
bundle
:
uw_ct_event
label
:
'
Hero
image'
description
:
'
'
required
:
false
translatable
:
true
default_value
:
{
}
default_value_callback
:
'
'
settings
:
handler
:
'
default:media'
handler_settings
:
target_bundles
:
uw_mt_image
:
uw_mt_image
sort
:
field
:
_none
auto_create
:
false
auto_create_bundle
:
'
'
field_type
:
entity_reference
config/install/views.view.uw_view_events.yml
View file @
02716f20
...
...
@@ -655,21 +655,19 @@ display:
entity_type
:
node
entity_field
:
sticky
plugin_id
:
standard
created
:
id
:
created
table
:
node_field_data
field
:
created
order
:
DESC
entity_type
:
node
entity_field
:
created
plugin_id
:
date
field_uw_event_date_value
:
id
:
field_uw_event_date_value
table
:
node__field_uw_event_date
field
:
field_uw_event_date_value
relationship
:
none
group_type
:
group
admin_label
:
'
'
order
:
ASC
exposed
:
false
expose
:
label
:
'
'
granularity
:
second
plugin_id
:
date
cache_metadata
:
max-age
:
-1
contexts
:
...
...
@@ -861,26 +859,10 @@ display:
groups
:
1
:
AND
pager
:
type
:
full
type
:
some
options
:
items_per_page
:
10
items_per_page
:
3
offset
:
0
id
:
0
total_pages
:
null
tags
:
previous
:
'
‹
Previous'
next
:
'
Next
›'
first
:
'
«
First'
last
:
'
Last
»'
expose
:
items_per_page
:
false
items_per_page_label
:
'
Items
per
page'
items_per_page_options
:
'
5,
10,
25,
50'
items_per_page_options_all
:
false
items_per_page_options_all_label
:
'
-
All
-'
offset
:
false
offset_label
:
Offset
quantity
:
9
allow
:
items_per_page
:
true
customizable_exposed_filters
:
...
...
@@ -1149,28 +1131,25 @@ display:
entity_type
:
node
entity_field
:
sticky
plugin_id
:
standard
created
:
id
:
created
table
:
node_field_data
field
:
created
order
:
DESC
entity_type
:
node
entity_field
:
created
plugin_id
:
date
field_uw_event_date_value
:
id
:
field_uw_event_date_value
table
:
node__field_uw_event_date
field
:
field_uw_event_date_value
relationship
:
none
group_type
:
group
admin_label
:
'
'
order
:
ASC
exposed
:
false
expose
:
label
:
'
'
granularity
:
second
plugin_id
:
date
cache_metadata
:
max-age
:
-1
contexts
:
-
'
languages:language_content'
-
'
languages:language_interface'
-
url
-
url.query_args
-
user
-
'
user.node_grants:view'
-
user.permissions
...
...
uw_ct_event.install
View file @
02716f20
...
...
@@ -5,6 +5,7 @@
* Install, update and uninstall for event content type.
*/
use
Drupal\field\Entity\FieldConfig
;
use
Drupal\node\Entity\Node
;
use
Drupal\taxonomy\Entity\Term
;
...
...
@@ -148,3 +149,100 @@ function uw_ct_event_update_8101(&$sandbox) {
}
}
}
/**
* Creates hero image copy from listing page image.
*/
function
uw_ct_event_update_8102
(
&
$sandbox
)
{
// Adding field to the bundle. FieldStorageConfig has already been created.
FieldConfig
::
create
([
'field_name'
=>
'field_uw_hero_image'
,
'entity_type'
=>
'node'
,
'bundle'
=>
'uw_ct_event'
,
'label'
=>
'Hero image'
,
'settings'
=>
[
'handler'
=>
'default:media'
,
'handler_settings'
=>
[
'target_bundles'
=>
[
'uw_mt_image'
=>
'uw_mt_image'
,
],
],
],
])
->
save
();
// Get all the nids for events.
$nids
=
\
Drupal
::
entityQuery
(
'node'
)
->
condition
(
'type'
,
'uw_ct_event'
)
->
execute
();
// Load all the event nodes.
$nodes
=
Node
::
loadMultiple
(
$nids
);
foreach
(
$nodes
as
$node
)
{
// Get listing page entity.
$listing_image
=
$node
->
field_uw_event_listing_page_img
->
entity
;
if
(
$listing_image
)
{
// Set hero image to use same photo as listing page.
$node
->
field_uw_hero_image
->
target_id
=
$listing_image
->
id
();
$node
->
save
();
}
}
}
/**
* Update location country and area to null if only components.
*/
function
uw_ct_event_update_8103
()
{
// Get the nids and nodes for all events.
$nids
=
\
Drupal
::
entityQuery
(
'node'
)
->
condition
(
'type'
,
'uw_ct_event'
)
->
execute
();
$nodes
=
Node
::
loadMultiple
(
$nids
);
// The address components that need to have
// values for us not to reset country/area.
$address_components
=
[
'organization'
,
'locality'
,
'postal_code'
,
'address_line1'
,
'address_line2'
,
];
// Step through each of the nodes and check
// if we need to update the country/area.
foreach
(
$nodes
as
$node
)
{
// Get the address field from the node.
$address
=
$node
->
field_uw_event_location_address
->
getValue
()[
0
];
// If there is an address, check if we need
// to update the country/area.
if
(
$address
)
{
// Flag to update the address. Initial set to
// TRUE, if we find that the address has a component
// then we will not update the country/area.
$address_update
=
TRUE
;
// Step through each of the components as see if
// it has a value, and if it does set the flag
// so that we do not update the country/area.
foreach
(
$address_components
as
$address_component
)
{
if
(
$address
[
$address_component
])
{
$address_update
=
FALSE
;
}
}
// If we are to update country/area, then update it,
// and save the node.
if
(
$address_update
)
{
$address
[
'country_code'
]
=
NULL
;
$address
[
'administrative_area'
]
=
NULL
;
$node
->
field_uw_event_location_address
->
setValue
(
$address
);
$node
->
save
();
}
}
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment