Is there a way to add a "more" or custom link to the block?

I have hours being called and would like to have a "more" link at the bottom of the block that includes to a link to a node.

CommentFileSizeAuthor
#3 agenda-2398087-3.patch1.2 KBpifagor

Comments

gooddesignusa’s picture

You can use hook_block_view_alter(&$data, $block) or template_preprocess_block.

On some of my projects we have a calendar page that accepts a hash in the URL to tell some jquery which google calendar to load in the iframe. We needed to add links to the bottom of the agenda block. Here is some of my code you can use as a reference.

I add some text before and after the block content.

//Adds a read more link to upcoming events block.
function custom_code_block_view_alter(&$data, $block){
	if(isset($data['subject'])){
		if($data['subject']=="Agenda"){
			//when shown in quicktab it has a # bid. when shown by itself it uses agenda-#
			$header="<div class='agenda-header-text'>";
			switch($block->bid){
				case '224':			
					$header.='Around Campus - Click any event for more information.';
					$hash_link = 'around-campus';
				break;			
				case '235':
				case 'agenda-3':
					$header.='Click any contest for more information and directions to game.';
					$hash_link = 'all-athletics';					
				break;
				case 'agenda-4':
					$header.='Click any event for more information.';				
					$hash_link = 'alumni';					
				break;
				case 'agenda-5':
					$hash_link = 'cross-country';
				break;				
			}
			$header.="</div>";
			$data['content']['#markup'] = $header.$data['content']['#markup'].'<div id="calendar-view-all">'.l('View all >', 'node/219', array('fragment' => $hash_link)).'</div>';
		}
	}
}
gooddesignusa’s picture

When I get some time I will make a patch that will add a footer link option to the agenda block settings.

pifagor’s picture

StatusFileSize
new1.2 KB

Check if this patch working, was unable to check his work

pifagor’s picture

Status: Active » Needs review
guschilds’s picture

Status: Needs review » Active

Thanks for the patch, pifagor, but it does not make sense to commit to the module. The code from #1 was just an example of implementing hook_block_view_alter(). It has block IDs, text, and node paths that are specific to a single site. No other site using this module would have those. If someone wishes to do something similar, they can implement that hook in a similar way from within a custom module. A patch for this that might make sense to commit would involve generic configuration that each site could use to accomplish its specific needs.