I added some code to calendar-datebox.tpl.php but I only want to it on a particular view. Any way to achieve this ?

Comments

mibfire’s picture

You can use the $view object. For example:

<?php
/**
 * @file
 * Template to display the date box in a calendar.
 *
 * - $view: The view.
 * - $granularity: The type of calendar this box is in -- year, month, day, or week.
 * - $mini: Whether or not this is a mini calendar.
 * - $class: The class for this box -- mini-on, mini-off, or day.
 * - $day:  The day of the month.
 * - $date: The current date, in the form YYYY-MM-DD.
 * - $link: A formatted link to the calendar day view for this day.
 * - $url:  The url to the calendar day view for this day.
 * - $selected: Whether or not this day has any items.
 * - $items: An array of items for this day.
 */
?>

<?php if ($view->name == 'YOUR_VIEW_NAME' && $view->current_display == 'YOUR_VIEW_DISPLAY'): ?>
  <!-- YOUR CUSTOM HTML -->
<?php else: ?>
  <div class="<?php print $granularity ?> <?php print $class; ?>"> <?php print !empty($selected) ? $link : $day; ?> </div>
<?php endif; ?>
schifazl’s picture

Version: 7.x-3.4 » 7.x-3.5
Issue summary: View changes

Sorry for reviving this old issue. It's possible to achieve this by adding the view name to the tpl file? E.g. calendar-datebox--view-name.tpl.php? I doesn't work for me, but maybe I'm screwing something.

Thanks!

mibfire’s picture

I think it is possible if you add this manually with theme suggestions.

Neslee Canil Pinto’s picture

Status: Active » Closed (outdated)