Commit bbbf33e5 authored by Liam Morland's avatar Liam Morland
Browse files

Refactor: Use l() in uw_ct_event_calendar_contents()

parent f4e44454
......@@ -1066,27 +1066,20 @@ function events_public_feed_link() {
}
/**
* Custom html block: display event calendar link.
* Custom HTML block: Display event calendar link.
*
* @return string
* Returns string containing html code of calendar contents
* The HTML of calendar contents.
*/
function uw_ct_event_calendar_contents() {
global $base_url;
$link = $base_url . '/events/calendar.ics';
// $image_path = base_path() . drupal_get_path('module', 'uw_ct_event')
// . '/images/ical-feed-icon-34x14.png';.
$html = '<div class="feed-icon">';
$event_exist = db_query("SELECT count(node.nid)
FROM {node} AS node LEFT JOIN {field_data_field_event_date} AS ed ON node.nid = ed.entity_id
WHERE node.type = 'uw_event' AND ed.field_event_date_value >= CURRENT_DATE AND node.status = 1
LIMIT 1")->fetchField();
$html = '<div class="feed-icon">';
if ($event_exist > 0) {
$html .= '<a class="ical-icon" href="' . $link . '">';
$html .= 'Export event calendar';
$html .= '</a>';
$html .= l(t('Export events calendar'), 'events/calendar.ics', ['attributes' => ['class' => ['ical-icon']]]);
}
$html .= '</div>';
return $html;
......
Supports Markdown
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