[ create a new paste ] login | about

Link: http://codepad.org/Bj8wVwpw    [ raw code | fork ]

randomblink - PHP, pasted on May 31:
<?php

function blinks_responsive_preprocess_node(&$variables) 
{
	$node = $variables['node'];
	if ($variables['view_mode'] == 'full' && node_is_page($variables['node'])) 
	{
		$variables['classes_array'][] = 'node-full';
	}

	if ( $node->type == 'netrunner_card' ) 
	{
		if( $variables['view_mode'] == 'full' )
		{
			// $blinksFileName = $node->field_card_type['und'][0]['taxonomy_term']->name;
			// $blinksFileName = str_replace( " ", "_", $blinksFileName);
			// $blinksTemplateName = 'node__netrunner_card__' . $blinksFileName . '__full';
			// $variables['theme_hook_suggestions'][] = $blinksTemplateName;
			$variables['theme_hook_suggestions'][] = 'node__netrunner_card__full';
		}
		_preprocess__netrunner_card__card_subtype( $variables );
	}

	// This creates custom function options for specific content types
	// foo_preprocess_node_page() or foo_preprocess_node_story().
	//$function = __FUNCTION__ . '_' . $variables['node']->type;
	//if (function_exists($function)) 
	//{
	//	$function($variables, $hook);
	//} 
	
	$variables['date'] = t('!datetime', array('!datetime' =>  date('j F Y', $variables['created'])));
	$variables['title'] =  $variables['field_unique_card'][0]['value'] ? '*' . $variables['title'] : '';

}

function _preprocess__netrunner_card__card_subtype( &$variables )
{
	if( isset( $variables['node']->field_card_subtype['und'] ) && count( $variables['node']->field_card_subtype['und'] > 0 ) )
	{
		foreach( $variables['node']->field_card_subtype['und'] as $cardSubtypes )
		{
			if( $cardSubtypes['taxonomy_term']->name == 'Icebreaker' )
			{
				$variables['isIcebreaker'] = True;
			}
		}
	}
	return $variables;
}

?>


Create a new paste based on this one


Comments: