Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
drupal-make
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Dehlan
drupal-make
Commits
1b5c3dc2
Commit
1b5c3dc2
authored
Apr 29, 2017
by
ekes
Browse files
Options
Downloads
Patches
Plain Diff
Add GEO and STATUS, correct LOCATION for iCal. Fixes #140,
parent
ee62f985
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/radar/radar_event_ical/radar_event_ical.module
+43
-0
43 additions, 0 deletions
modules/radar/radar_event_ical/radar_event_ical.module
with
43 additions
and
0 deletions
modules/radar/radar_event_ical/radar_event_ical.module
+
43
−
0
View file @
1b5c3dc2
...
@@ -122,4 +122,47 @@ function radar_event_ical_date_ical_export_raw_event_alter(&$event, $view, $cont
...
@@ -122,4 +122,47 @@ function radar_event_ical_date_ical_export_raw_event_alter(&$event, $view, $cont
if
(
isset
(
$event
[
'rrule'
]))
{
if
(
isset
(
$event
[
'rrule'
]))
{
unset
(
$event
[
'rrule'
]);
unset
(
$event
[
'rrule'
]);
}
}
// Add LOCATION
// Only one location is valid in iCal. We join on the first field_offline.
if
(
!
empty
(
$context
[
'row'
]
->
field_field_address
))
{
$location_html
=
render
(
$context
[
'row'
]
->
field_field_address
[
0
][
'rendered'
]);
$location_array
=
[];
preg_match_all
(
"'<[^>]*>(.*?)</[^>]*>'si"
,
$location_html
,
$location_array
);
if
(
!
empty
(
$location_array
))
{
foreach
(
$location_array
[
0
]
as
$delta
=>
$row
)
{
$location_array
[
0
][
$delta
]
=
strip_tags
(
$row
);
}
$event
[
'location'
]
=
implode
(
', '
,
$location_array
[
0
]);
}
}
// Add GEO.
if
(
!
empty
(
$context
[
'row'
]
->
field_field_map
)
&&
$context
[
'row'
]
->
field_field_map
[
0
][
'raw'
][
'geo_type'
]
==
'point'
)
{
$event
[
'geo'
][
'lat'
]
=
$context
[
'row'
]
->
field_field_map
[
0
][
'raw'
][
'lat'
];
$event
[
'geo'
][
'lon'
]
=
$context
[
'row'
]
->
field_field_map
[
0
][
'raw'
][
'lon'
];
}
// Add STATUS.
if
(
!
empty
(
$context
[
'row'
]
->
field_field_event_status
))
{
$event
[
'status'
]
=
strtoupper
(
render
(
$context
[
'row'
]
->
field_field_event_status
[
0
][
'rendered'
]));
}
}
/**
* Implements hook_ical_date_ical_export_vevent_alter().
*/
function
radar_event_ical_date_ical_export_vevent_alter
(
&
$vevent
,
$view
,
$event
)
{
// Location is already set.
// Add GEO and STATUS.
if
(
!
empty
(
$event
[
'geo'
]))
{
$vevent
->
setGeo
(
$event
[
'geo'
][
'lat'
],
$event
[
'geo'
][
'lon'
]);
}
if
(
!
empty
(
$event
[
'status'
]))
{
$vevent
->
setStatus
(
$event
[
'status'
]);
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment