function date_ical_plugin_style_ical_feed::attach_to in Date iCal 7.2
Same name and namespace in other branches
- 7.3 includes/date_ical_plugin_style_ical_feed.inc \date_ical_plugin_style_ical_feed::attach_to()
- 7 date_ical_plugin_style_ical_feed.inc \date_ical_plugin_style_ical_feed::attach_to()
File
- includes/
date_ical_plugin_style_ical_feed.inc, line 18 - Views style plugin for the Date iCal module.
Class
- date_ical_plugin_style_ical_feed
- Default style plugin to render an iCal feed.
Code
function attach_to($display_id, $path, $title) {
$display = $this->view->display[$display_id]->handler;
$url_options = array();
$input = $this->view
->get_exposed_input();
if ($input) {
$url_options['query'] = $input;
}
$url_options['absolute'] = TRUE;
$url = url($this->view
->get_url(NULL, $path), $url_options);
// If the user didn't disable the option, change the scheme to webcal:// so
// that calendar clients can automatically subscribe via the iCal link.
if (!$this
->_get_option('disable_webcal')) {
$url = str_replace(array(
'http://',
'https://',
), 'webcal://', $url);
}
// Render the feed icon and header tag (except during a View Preview).
if (empty($this->view->live_preview)) {
$tooltip = t('Add to My Calendar');
if (!isset($this->view->feed_icon)) {
// In PHP 5.5, you're no longer allowed to concatinate onto a not-yet-existent property.
$this->view->feed_icon = '';
}
$this->view->feed_icon .= theme('date_ical_icon', array(
'url' => check_url($url),
'tooltip' => $tooltip,
'view' => $this->view,
));
drupal_add_html_head_link(array(
'rel' => 'alternate',
'type' => 'text/calendar',
'title' => $tooltip,
'href' => $url,
));
}
}