From 9ef14a25ba64abd802954d464305ebed6b72bbfd Mon Sep 17 00:00:00 2001 From: Mikkel Hoegh Date: Wed, 10 Oct 2012 20:23:30 +0200 Subject: [PATCH 1/3] Showing link to more events on events list. --- ding_content_tema/ding_content_tema.module | 18 +++++++++++++++ .../ding_content_tema.views_default.inc | 23 +++++++++++-------- 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/ding_content_tema/ding_content_tema.module b/ding_content_tema/ding_content_tema.module index 3fa7a31..2db9bf0 100644 --- a/ding_content_tema/ding_content_tema.module +++ b/ding_content_tema/ding_content_tema.module @@ -64,6 +64,24 @@ function ding_content_tema_nodeapi(&$node, $op, $teaser, $page) { } } +/** + * Implements hook_views_pre_render(). + */ +function ding_content_tema_views_pre_render(&$view) { + // When the event list is being displayed on a tema site page page... + if ($view->name == 'tema_sites' && $view->current_display == 'panel_pane_2') { + // Generate link to the library's event page. This assumes that + // we're on the main event page, but this view is not displayed + // anywhere else at the moment, so it should be a fairly safe assumption. + $url = $_GET['q'] . '/arrangementer'; + + // And overwrite the footer contents with it. + $view->display_handler->options['footer'] = l(t('More events'), $url, array( + 'attributes' => array('class' => 'more-link'), + )); + } +} + /** * Helper function to create menu for them sites. * diff --git a/ding_content_tema/ding_content_tema.views_default.inc b/ding_content_tema/ding_content_tema.views_default.inc index c6701eb..80f194c 100644 --- a/ding_content_tema/ding_content_tema.views_default.inc +++ b/ding_content_tema/ding_content_tema.views_default.inc @@ -737,22 +737,25 @@ function ding_content_tema_views_default_views() { ), )); $handler->override_option('title', 'Arrangementer'); - $handler->override_option('pane_title', 'Event list (frontpage)'); + $handler->override_option('footer', 'Flere arrangementer'); + $handler->override_option('footer_format', '1'); + $handler->override_option('footer_empty', 0); + $handler->override_option('pane_title', 'Arrangementsliste'); $handler->override_option('pane_description', ''); $handler->override_option('pane_category', array( 'name' => 'Tema page', 'weight' => '0', )); $handler->override_option('allow', array( - 'use_pager' => FALSE, - 'items_per_page' => FALSE, - 'offset' => FALSE, - 'link_to_view' => FALSE, - 'more_link' => FALSE, - 'path_override' => FALSE, - 'title_override' => FALSE, - 'exposed_form' => FALSE, - 'fields_override' => FALSE, + 'use_pager' => 0, + 'items_per_page' => 0, + 'offset' => 0, + 'link_to_view' => 0, + 'more_link' => 'more_link', + 'path_override' => 0, + 'title_override' => 0, + 'exposed_form' => 0, + 'fields_override' => 0, )); $handler->override_option('argument_input', array( 'field_tema_ref_nid' => array( From 0461ea33190fdaa279441eb8fec8503a1f804828 Mon Sep 17 00:00:00 2001 From: Mikkel Hoegh Date: Fri, 26 Oct 2012 14:07:13 +0200 Subject: [PATCH 2/3] Code style compliance. --- ding_content_tema/ding_content_tema.module | 36 +++++++++++++--------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/ding_content_tema/ding_content_tema.module b/ding_content_tema/ding_content_tema.module index 2db9bf0..fa0f964 100644 --- a/ding_content_tema/ding_content_tema.module +++ b/ding_content_tema/ding_content_tema.module @@ -1,10 +1,14 @@ 0, ); - // Set tema ref field to required (done here, so its only required on the node form). + // Set tema ref field to required (done here, so its only required + // on the node form). if (isset($form['field_tema_ref'])) { $form['field_tema_ref']['#required'] = TRUE; } @@ -21,7 +26,7 @@ function ding_content_tema_form_alter(&$form, $form_state, $form_id) { // Don't display menu settings and attachments. unset($form['attachments']); - // Hide the revision settings and never allow creating new versions + // Hide the revision settings and never allow creating new versions. unset($form['revision_information']); $form['revision'] = array( '#type' => 'value', @@ -38,7 +43,7 @@ function ding_content_tema_form_alter(&$form, $form_state, $form_id) { function ding_content_tema_nodeapi(&$node, $op, $teaser, $page) { if ($node->type == 'tema_site') { if ($op == 'insert') { - // Create a menu for the newly create tema site + // Create a menu for the newly create tema site. _ding_tema_menu($node, FALSE); } elseif ($op == 'update') { @@ -54,11 +59,11 @@ function ding_content_tema_nodeapi(&$node, $op, $teaser, $page) { elseif ($op == 'delete') { // Delete the tema site menu and the associated links. db_query("DELETE FROM {menu_links} WHERE menu_name = 'tema-site-%d'", array( - ':nid' => $node->nid + ':nid' => $node->nid, )); db_query("DELETE FROM {menu_custom} WHERE menu_name = 'tema-site-%d'", array( - ':nid' => $node->nid + ':nid' => $node->nid, )); } } @@ -70,7 +75,7 @@ function ding_content_tema_nodeapi(&$node, $op, $teaser, $page) { function ding_content_tema_views_pre_render(&$view) { // When the event list is being displayed on a tema site page page... if ($view->name == 'tema_sites' && $view->current_display == 'panel_pane_2') { - // Generate link to the library's event page. This assumes that + // Generate link to the tema site event page. This assumes that // we're on the main event page, but this view is not displayed // anywhere else at the moment, so it should be a fairly safe assumption. $url = $_GET['q'] . '/arrangementer'; @@ -85,8 +90,10 @@ function ding_content_tema_views_pre_render(&$view) { /** * Helper function to create menu for them sites. * - * @param $node - * @param $update + * @param stdClass $node + * Node object. + * @param boolean $update + * Update existing data or create new data. */ function _ding_tema_menu($node, $update = TRUE) { $menu = array( @@ -98,10 +105,10 @@ function _ding_tema_menu($node, $update = TRUE) { drupal_write_record('menu_custom', $menu, array('menu_name')); } else { - // Create the main menu + // Create the main menu. drupal_write_record('menu_custom', $menu); - // Add blog link + // Add blog link. $item = array( 'menu_name' => $menu['menu_name'], 'link_title' => t('Blog'), @@ -112,7 +119,7 @@ function _ding_tema_menu($node, $update = TRUE) { menu_link_save($item); - // Add event link + // Add event link. $item = array( 'menu_name' => $menu['menu_name'], 'link_title' => t('Events'), @@ -136,6 +143,5 @@ function _ding_tema_menu($node, $update = TRUE) { } } -// Load the feature information -include_once('ding_content_tema.features.inc'); - +// Load the feature code. +include_once 'ding_content_tema.features.inc'; From 26a9151e613c0f8fb9638e1dc5dd9a43136020a5 Mon Sep 17 00:00:00 2001 From: Mikkel Hoegh Date: Fri, 26 Oct 2012 14:10:23 +0200 Subject: [PATCH 3/3] Use the alias'ed version of the event URL. node/5353/arrangementer does not work for event pages. --- ding_content_tema/ding_content_tema.module | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ding_content_tema/ding_content_tema.module b/ding_content_tema/ding_content_tema.module index fa0f964..c1ca92b 100644 --- a/ding_content_tema/ding_content_tema.module +++ b/ding_content_tema/ding_content_tema.module @@ -78,7 +78,7 @@ function ding_content_tema_views_pre_render(&$view) { // Generate link to the tema site event page. This assumes that // we're on the main event page, but this view is not displayed // anywhere else at the moment, so it should be a fairly safe assumption. - $url = $_GET['q'] . '/arrangementer'; + $url = $_REQUEST['q'] . '/arrangementer'; // And overwrite the footer contents with it. $view->display_handler->options['footer'] = l(t('More events'), $url, array(