Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
date_ical
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
drupal.org
date_ical
Commits
87b8fd44
Commit
87b8fd44
authored
12 years ago
by
Robert Rollins
Browse files
Options
Downloads
Patches
Plain Diff
Added hook_date_ical_html_alter()
parent
fe4415f8
No related branches found
Branches containing commit
Tags
7.x-2.4
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
date_ical.api.php
+21
-1
21 additions, 1 deletion
date_ical.api.php
includes/date_ical_plugin_row_ical_entity.inc
+16
-8
16 additions, 8 deletions
includes/date_ical_plugin_row_ical_entity.inc
with
37 additions
and
9 deletions
date_ical.api.php
+
21
−
1
View file @
87b8fd44
<?php
/**
* Alter the HTML of an event's Summary and Description, before it gets converted
* to plaintext for output in an iCal feed.
*
* @param $data
* A reference to an associative array with the following keys and values:
* - 'description': The rendered HTML of the iCal view mode of the entity.
* - 'summary': The title of the entity.
* @param $view
* The view object that is being executed to render the iCal feed.
* @param $context
* An associative array of context, with the following keys and values:
* - 'entity_type': The type of entity being rendered, 'node', 'user' etc.
* - 'entity': The fully loaded entity being rendered.
* - 'language': The language code that indicates which translation of field
* data should be used.
*/
function
hook_date_ical_html_alter
(
&
$data
,
$view
,
&
$context
)
{
}
/**
* Modify a structured event before it is rendered to iCal format.
*
...
...
@@ -19,7 +40,6 @@
* - 'entity': The fully loaded entity being rendered.
* - 'language': The language code that indicates which translation of field
* data should be used.
*
*/
function
hook_date_ical_feed_event_render_alter
(
&
$event
,
$view
,
&
$context
)
{
// Simple example adding the location to a rendered event from a simple
...
...
This diff is collapsed.
Click to expand it.
includes/date_ical_plugin_row_ical_entity.inc
+
16
−
8
View file @
87b8fd44
...
...
@@ -233,11 +233,24 @@ class date_ical_plugin_row_ical_entity extends views_plugin_row {
// Create the rendered display using the display settings from the 'iCal' view mode.
$rendered_array
=
entity_view
(
$this
->
entity_type
,
array
(
$entity
),
'ical'
,
$this
->
language
,
TRUE
);
$item_text
=
drupal_render
(
$rendered_array
);
$data
=
array
(
'description'
=>
drupal_render
(
$rendered_array
),
'summary'
=>
entity_label
(
$this
->
entity_type
,
$entity
)
);
// Allow other modules to alter the HTML of the Summary and Description,
// before it gets converted to iCal-compliant plaintext. This allows users
// to set up a newline between fields, for instance.
$context
=
array
(
'entity'
=>
$entity
,
'entity_type'
=>
$this
->
entity_type
,
'language'
=>
$this
->
language
,
);
drupal_alter
(
'date_ical_html'
,
$data
,
$this
->
view
,
$context
);
$event
=
array
();
$event
[
'summary'
]
=
trim
(
drupal_html_to_text
(
entity_label
(
$this
->
entity_type
,
$entity
)
));
$event
[
'description'
]
=
trim
(
drupal_html_to_text
(
$
item_text
));
$event
[
'summary'
]
=
trim
(
drupal_html_to_text
(
$data
[
'summary'
]
));
$event
[
'description'
]
=
trim
(
drupal_html_to_text
(
$
data
[
'description'
]
));
$event
[
'all_day'
]
=
$all_day
;
$event
[
'start'
]
=
$start
;
$event
[
'end'
]
=
$end
;
...
...
@@ -256,11 +269,6 @@ class date_ical_plugin_row_ical_entity extends views_plugin_row {
$event
[
'last-modified'
]
=
new
DateObject
(
$entity
->
changed
,
new
DateTimeZone
(
'UTC'
));
// Allow other modules to alter the structured event object, before it gets converted to an iCal VEVENT.
$context
=
array
(
'entity'
=>
$entity
,
'entity_type'
=>
$this
->
entity_type
,
'language'
=>
$this
->
language
,
);
drupal_alter
(
'date_ical_feed_event_render'
,
$event
,
$this
->
view
,
$context
);
return
$event
;
...
...
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