Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save intergalactic-overlords/e7ff832451e5fc8adc9c to your computer and use it in GitHub Desktop.
Save intergalactic-overlords/e7ff832451e5fc8adc9c to your computer and use it in GitHub Desktop.
Drupal 7 DS 1 column completely clickable
folder ds_layouts
> folder ds_1col_linked
> file ds-1col-linked.tpl.php
> file ds_1col_linked.inc
<?php
/**
* @file
* Linked 1 column template.
*/
?>
<?php
// is it a node or a taxonomy term?
$link = '';
if (isset($variables['node_url'])) {
$link = $variables['node_url'];
} else if (isset($variables['vocabulary_machine_name'])) {
$link = url('taxonomy/term/' . $variables['tid']);
}
?>
<<?php print $ds_content_wrapper; print $layout_attributes; ?> class="1col-linked <?php print $classes;?> clearfix">
<?php if (isset($title_suffix['contextual_links'])): ?>
<?php print render($title_suffix['contextual_links']); ?>
<?php endif; ?>
<?php if (!empty($link)): ?>
<a class="wrap-link" href="<?php print $link; ?>">
<?php endif; ?>
<?php print $ds_content; ?>
<?php if (!empty($link)): ?>
</a>
<?php endif; ?>
</<?php print $ds_content_wrapper ?>>
<?php if (!empty($drupal_render_children)): ?>
<?php print $drupal_render_children ?>
<?php endif; ?>
<?php
function ds_1col_linked() {
return array(
'label' => t('One column linked'),
'regions' => array(
'ds_content' => t('Content'),
),
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment