Monday 29 June 2015

Hook Examples

hook_form
   modules/node/node.api.php    
Display a node editing form
hook_form_alter        
modules/system/system.api.php
Perform alterations before a form is rendered.

hook_menu   
modules/system/system.api.php   
Define menu items and page callbacks
hook_menu_alter   
modules/system/system.api.php   
Alter the data being saved to the {menu_router} table after hook_menu is invoked
hook_menu_delete    
modules/menu/menu.api.php   
Respond to a custom menu deletion.

hook_node_validate        
modules/node/node.api.php
Perform node validation before a node is created or updated.

module_hook        
includes/module.inc
Determines whether a module implements a hook.

hook_user_categories        
modules/user/user.api.php
Retrieve a list of user setting or profile information categories.

hook_user_delete    
modules/user/user.api.
php     Respond to user deletion.

hook_user_insert    .

modules/user/user.api.php   
A user account was created
hook_user_load        
modules/user/user.api.php
Act on user objects when loaded from the database.

hook_user_login    

modules/user/user.api.php   
The user just logged in.
hook_user_logout    
modules/user/user.api.php   
The user just logged out.

Friday 26 June 2015

Page--front.tpl.php

<div class="container main-container">
<div class="row">
    <div class="col-lg-4 col-md-6 col-sm-6 col-xs-24">
<?php if ($logo): ?>
 <a  href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" rel="home" id="logo">
<img class="img-responsive" src="<?php print $logo; ?>" alt="<?php print t('Home'); ?>" />
 </a>
 <?php endif; ?>
</div>
<div class="col-lg-20 col-md-18 col-sm-18 col-xs-24">


<div class="top-btns pull-right">
<ul>
 <li class="sign-in"><a href="#myModal" data-toggle="modal"><i class="fa fa-thumb-tack"></i>Sign In</a></li>
 <div id="myModal" class="modal fade">
<div class="modal-dialog">
 <div class="modal-content position-right">
<div class="online-bank top-scroll">
 <button type="button" class="close pop-up" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
 <h3>Sign In</h3>
 <div class="">
<div class="online-bank-content">
 <input type="text" placeholder="Email Address" name="">
 <input type="password" placeholder="Password" name="">
 <div class="forgot-pass"><a href="https://www.sdfcuib.org/tob/live/usp-core/app/authUpdate#" target="_new">I forgot my password</a></div>
 <input type="submit" class="submit" value="Sign In" name="">
</div>
 </div>
</div>
 </div>
</div>
 </div>
 <?php print render($page['topmenu']); ?>
 <?php /*
          $block = module_invoke('search', 'block_view', 'search');
          print render($block); */
?>
</ul>

</div>


</div>
<div class="col-lg-20 col-md-24 col-sm-24 col-xs-24 alpha omega" >


<div class="menu pull-right omega">
<ul class="visible-xs">
<li class="join"><img src="<?php print $directory; ?>/images/tick-ico.png"><?php print render($page['join']); ?></li>
 <li class="search"><!--<input type="text" placeholder="Search">-->
            <?php print render($page['search']); ?>
          </li>
</ul>

<div class="main-menu">
<nav class="navbar navbar-default" role="navigation">
<div class="navbar-header">
 <div class="navbar-toggle-text">menu</div>
 <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" value="MENU"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button>

</div>
            <!--/.navbar-header-->
           
            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
           
<?php

$main_menu = variable_get('menu_main_links_source', 'menu-sdfcu-menu');
$tree = menu_tree($main_menu);
print render($tree);
//print render($page['mainmenu']);
?>
</div>
            <!--/.navbar-collapse-->
          </nav>
        </div>
        <ul class="hidden-xs">
         
<li class="join"><img src="<?php print $directory; ?>/images/tick-ico.png"><?php print render($page['join']); ?></li>
 <li class="search"><!--<input type="text" placeholder="Search">-->
            <?php print render($page['search']); ?>
          </li>
        </ul>
        <span class="clearfix"></span> </div>
</div>
  </div>
 
 
</div>



<div class="container main-container">
  <div class="row">
    <div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
      <!-- Indicators -->
      <ol class="carousel-indicators banner-controls">
        <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
        <li data-target="#carousel-example-generic" data-slide-to="1"></li>
        <li data-target="#carousel-example-generic" data-slide-to="2"></li>
      </ol>
     
      <!-- Wrapper for slides -->
      <div class="carousel-inner main-banner" role="listbox">
        <!-- Start WOWSlider.com BODY section -->
<div id="wowslider-container1">
<div class="ws_images"><ul>
<li><img src="<?php echo $directory; ?>/data1/images/banner1.png" alt="banner1" title="banner1" id="wows1_0"/></li>
<li><img src="<?php echo $directory; ?>/data1/images/banner2.png" alt="banner2" title="banner2" id="wows1_1"/></li>
<li><img src="<?php echo $directory; ?>/data1/images/banner3.png" alt="banner3" title="banner3" id="wows1_2"/></li>
<li><img src="<?php echo $directory; ?>/data1/images/banner4.png" alt="carousel slider" title="banner4" id="wows1_3"/></li>
<li><img src="<?php echo $directory; ?>/data1/images/banner5.png" alt="banner5" title="banner5" id="wows1_4"/></li>
</ul></div>
<div class="ws_bullets">
<div>
<a href="#" title="banner1"><span><img src="<?php echo $directory; ?>/data1/tooltips/banner1.png" alt="banner1"/>1</span></a>
<a href="#" title="banner2"><span><img src="<?php echo $directory; ?>/data1/tooltips/banner2.png" alt="banner2"/>2</span></a>
<a href="#" title="banner3"><span><img src="<?php echo $directory; ?>/data1/tooltips/banner3.png" alt="banner3"/>3</span></a>
<a href="#" title="banner4"><span><img src="<?php echo $directory; ?>/data1/tooltips/banner4.png" alt="banner4"/>4</span></a>
<a href="#" title="banner5"><span><img src="<?php echo $directory; ?>/data1/tooltips/banner5.png" alt="banner5"/>5</span></a>
</div>
</div>
<div class="ws_shadow"></div>
</div>
<!-- End WOWSlider.com BODY section -->
      </div>
     
   
    </div>
  </div>
</div>
<div class="container main-container">
  <div class="row">
  <h2 class="featured-service-title">Featured Service</h2>
     <div class="col-lg-6 col-md-5 col-sm-24 col-xs-24 online-bank omega">
<form action="https://www.sdfcuib.org/tob/live/usp-core/app/initialLogin" autocomplete="off" id="Login" method="post" name="Login" onsubmit="return setParamStatus();" target="_parent">
<h3>Sign In</h3>
<div class="row">
           
<div class="online-bank-content">
<input placeholder="Email Address" class="style3" id="userNumber" name="userid"   type="text" />
<input  placeholder="Password" id="password" maxlength="25" name="password"   type="password" />
<div class="forgot-pass"><a href="https://www.sdfcuib.org/tob/live/usp-core/app/authUpdate#" target="_new">I forgot my password</a></div>
<input class="submit" type="submit" value="Sign In" />
<input id="testcookie" name="testcookie" type="hidden" value="false" />
<input id="testjs" name="testjs" type="hidden" value="false" />
<input id="dscheck" name="dscheck" type="hidden" value="0" /></td>
</div>
</div>
</form>
    </div>
    <div class="col-lg-18 col-md-24 col-sm-24 col-xs-24">

     
      <ul class="nav nav-tabs tabs-custom" role="tablist" id="myTab">
<?php

$blocks = block_list('featured_services');
foreach($blocks as $block1)
{
?>
<!-- Featured Services Tabs start -->

<li role="presentation">
<a class="<?php echo strtolower(str_replace(' ','_',$block1->title)); ?>" href="#<?php echo strtolower(str_replace(' ','_',$block1->title)); ?>" aria-controls="<?php echo strtolower(str_replace(' ','_',$block1->title)); ?>" role="tab" data-toggle="tab"><?php echo $block1->title; ?></a>
</li>
<?php
}
?>
 </ul>
      <div class="tab-content">
 <?php      
 foreach($blocks as $block1)
 {
 ?>
 <div role="tabpanel" class="tab-pane" id="<?php echo strtolower(str_replace(' ','_',$block1->title)); ?>">
 <?php
echo $block1->content['#markup'];
 ?>
 </div>
 <?php   } ?>
      </div>
      <script>
 jQuery(function () {
jQuery('#myTab a:first').tab('show')
 })
 </script>
    </div>
    </div>
  </div>
</div>
<div class="container main-container">
  <!--<div class="row">-->
  <div class="services">
   
    <?php print render($page['rates']); ?>
  </div>
  <div class="services-tab"><a href="#">View all of SDFU's LOW rates</a> <span class="glyphicon glyphicon-play" aria-hidden="true"></span></div>
 
  <!--</div>-->
</div>
<div class="container main-container">
  <div class="row">
    <div class="col-lg-8 col-md-8 col-sm-8 col-xs-24">
      <div class="help-us">
        <h1 style="border-bottom:none;">Help <b>Us</b>, Help <b>You</b></h1>
        <p><!--We are commited to making your experience with SDFCU The best we can !-->We are commited to you!</p>
        <div class="inner-help-us"> <img src="<?php echo $directory; ?>/images/help-us.png" />
          <p>Take a minute to tell us what we are doing well or what we are doing not so well</p>
        </div>
        <a href="#helpus" data-toggle="modal"><div class="go-img"> </div></a>
        <div id="helpus" class="modal fade">
<div class="modal-dialog">
 <div class="modal-content position-right">
<div class="online-bank top-scroll">
 <button type="button" class="close pop-up" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>

 <div class="row">
<div class="membership-comments">
 <?php
module_load_include('inc', 'node', 'node.pages');

$form = node_add('helpus');

print drupal_render($form);
?>
</div>
 </div>
</div>
 </div>
</div>
 </div>
       
      </div>
    </div>
    <div class="col-lg-8 col-md-8 col-sm-8 col-xs-24">
      <div class="help-us">
        <h1 style="border-bottom:none;">Message from our Board</h1>
        <?php print render($page['video']); ?>
</div>
    </div>
    <div class="col-lg-8 col-md-8 col-sm-8 col-xs-24">
<div class="marketing_ads"><ul class="marketing_ads_slider" style="display:none;">
<?php
$nids = db_select('node', 'n')
->fields('n', array('nid','type'))
->condition('n.type', 'marketing_ads')
->execute()
->fetchAll();
foreach($nids as $nid)
{
$node_value= $nid->nid;
$result = node_load($node_value);


?>
<li>

<div class="comming-soon"><a target="_blank" href="<?php echo $result->field_hyperlink['und'][0]['value']; ?>"><img src="<?php echo file_create_url($result->field_marketing_image['und']['0']['uri']); ?>"></a></div>

</li>
<?php
}
?>

       </ul>
       <div class="learn-more"></div>
     
 </div>
    </div>
  </div>
</div>
<div class="container main-container">
  <div class="row">
    <div class="col-lg-8 col-md-8 col-sm-8 col-xs-24">
      <div class="member-test tier1">
        <h1>Member Testimonials</h1>
        <ul class="bxslider" style="display:none">
<?php
print render($page['membertestimonials']);
?>
        </div>
    </div>
    <div class="col-lg-8 col-md-8 col-sm-8 col-xs-24">
      <div class="member-test tier1">
        <h1>Blog Portal</h1>
          <ul class="bxslider" style="display:none;">
<?php
$nids = db_select('node', 'n')
->fields('n', array('nid','type'))
->condition('n.type', 'blog')
->execute()
->fetchAll();
foreach($nids as $nid)
{
$node_value= $nid->nid;
$result = node_load($node_value);
?>
<li>
<h2><a href="<?php print url('node/'.$result->nid); ?>"><?php print $result->title; ?></a></h2>
<div><?php print substr($result->body['und'][0]['value'],0,100); ?> ... <a href="<?php print url('node/'.$result->nid); ?>"> Read more</a> </div>

</li>
<?php
}
?>
</ul>
</div>
    </div>
     <div class="col-lg-8 col-md-8 col-sm-8 col-xs-24">
      <div class="member-test tier1">
  <h1>News and Press</h1>
  <ul class="bxslider" style="display:none">
<?php
$nids = db_select('node', 'n')
->fields('n', array('nid','type'))
->condition('n.type', 'news')
->execute()
->fetchAll();
foreach($nids as $nid)
{
$node_value= $nid->nid;
$result = node_load($node_value);
?>
<li>
<h2><a href="<?php print url('node/'.$result->nid); ?>"><?php print $result->title; ?></a></h2>
<div><?php print substr($result->body['und'][0]['value'],0,100); ?> ... <a href="<?php print url('node/'.$result->nid); ?>"> Read more</a> </div>

</li>
<?php
}
?>
</ul>
 </div>
    </div>


  </div>
</div>


<div class="container-fluid main-container">
  <div class="row">
    <div class="footer">
<div class="container">
<div class="row">
<?php print render($page['footer_links']); ?>
</div>
</div>

<div class="container-fluid footer-top-border">
<div class="container">
<div class="col-lg-24 col-md-24 col-sm-24 col-xs-24 top-footer-menu">
<div class="row">
<?php
$tree = menu_tree_all_data('menu-footer-top-menu');
print drupal_render(menu_tree_output($tree));
?>
</div>
</div>
</div>
</div>

<div class="container">
<?php
$tree2 = menu_tree_all_data('menu-footer-menu');
print drupal_render(menu_tree_output($tree2));
?>

<div class="clearfix"></div>

<?php print render($page['copyright']); ?>
</div>
</div>
  </div>
</div>




<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->

<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="<?php echo $directory; ?>/js/bootstrap.min.js"></script>

node.tpl.php

<div class="container main-container">
  <div class="row">
 
  <?php
/**
 * Provides child menu & active parent of active parent...
 */



$path = 'node/'.$node->nid.'';
$parent = menu_link_get_preferred($path);
$parameters = array(

    'active_trail' => array($parent['plid']),
    'only_active_trail' => FALSE,
    'min_depth' => $parent['depth']+1,
    'max_depth' => $parent['depth']+1,
    'conditions' => array('plid' => $parent['mlid']),
  );

$children = menu_build_tree($parent['menu_name'], $parameters);

 foreach($children as $child)
{

if($child['link']['depth'] == 3)

{


?>
<div class="services">
<?php print render($page['rates']); ?>
  </div>


    <div class="col-lg-6 col-md-5 col-sm-24 col-xs-24 caluclators-tools">
      <h3>Caluclators and Tools</h3>
    </div>
   
 
   
    <div class="col-lg-18 col-md-24 col-sm-24 col-xs-24">






<ul class="nav nav-tabs tabs-custom" role="tablist" id="myTab">

<!-- Featured Services Tabs start -->

<?php foreach($children as $child)
{

$title1 = $child['link']['link_title'];
$title = str_replace('?','',$child['link']['link_title']);
$path = $child['link']['href'];
$nid = str_replace('node/','',$child['link']['link_path']);
$test = node_load($nid);


 ?>

<li role="presentation">
<a class="<?php echo strtolower(str_replace(' ','_',$title)); ?>" href="#<?php echo strtolower(str_replace(' ','_',$title)); ?>" aria-controls="<?php echo strtolower(str_replace(' ','_',$title)); ?>" role="tab" data-toggle="tab"><?php echo $title; ?></a>
</li>
<?php
}
?>
</ul>
      <div class="tab-content">
     
<?php foreach($children as $child)
{

$title1 = $child['link']['link_title'];
$title = str_replace('?','',$child['link']['link_title']);
$path = $child['link']['href'];
$nid = str_replace('node/','',$child['link']['link_path']);
$test = node_load($nid);


 ?>
 
<div role="tabpanel" class="tab-pane" id="<?php echo strtolower(str_replace(' ','_',$title)); ?>">
<?php
echo $test->body['und']['0']['value'];
?>
</div>
<?php   } ?>
      </div>


      <!--<h2 class="featured-service-title">Featured Service</h2>-->
 
   
    </div>
  </div>
</div>
<div class="container main-container">
  <div class="row">
    <div class="col-lg-8 col-md-8 col-sm-24 col-xs-24">
      <div class="emv-card">
        <h1>EMV Credit Cards</h1>
        <p>Take a minute to tell us what we are doing well or what we are doing not so well Take a minute to tell us what we are doing </p>
        <div class="view-all"><a href="#"><img src="<?php echo $directory; ?>/images/learn-more.png" alt="Learn More" title="Learn More" /></a></div>
      </div>
    </div>
    <div class="col-lg-8 col-md-8 col-sm-24 col-xs-24">
      <div class="emv-card">
        <h1>Low Mortgages Rates</h1>
        <p>Take a minute to tell us what we are doing well or what we are doing not so well Take a minute to tell us what we are doing </p>
        <div class="view-all"><a href="#"><img src="<?php echo $directory; ?>/images/learn-more.png" alt="Learn More" title="Learn More" /></a></div>
      </div>
    </div>
    <div class="col-lg-8 col-md-8 col-sm-24 col-xs-24">
      <div class="emv-card">
        <h1>Auto and Boat Loans</h1>
        <p>Take a minute to tell us what we are doing well or what we are doing not so well Take a minute to tell us what we are doing </p>
        <div class="view-all"><a href="#"><img src="<?php echo $directory; ?>/images/learn-more.png" alt="Learn More" title="Learn More" /></a></div>
      </div>
    </div>
  </div>
</div>

<?php break;  }
if($child['link']['depth'] == 4)

{

?>
<div class="col-lg-2 col-md-2 col-sm-0 col-xs-0"> </div>
  <div class="col-lg-20 col-md-20 col-sm-24 col-xs-24 tabs-custom-two">
     <ul class="nav nav-tabs tabs-custom" role="tablist" id="myTab">

<!-- Featured Services Tabs start -->

<?php foreach($children as $child)
{

$title1 = $child['link']['link_title'];
$title = str_replace('?','',$child['link']['link_title']);
$path = $child['link']['href'];
$nid = str_replace('node/','',$child['link']['link_path']);
$test = node_load($nid);


 ?>

<li role="presentation">
<a class="<?php echo strtolower(str_replace(' ','_',$title)); ?>" href="#<?php echo strtolower(str_replace(' ','_',$title)); ?>" aria-controls="<?php echo strtolower(str_replace(' ','_',$title)); ?>" role="tab" data-toggle="tab"><?php echo $title; ?></a>
</li>
<?php
}
?>
</ul>
      <div class="tab-content">
     
<?php foreach($children as $child)
{

$title1 = $child['link']['link_title'];
$title = str_replace('?','',$child['link']['link_title']);
$path = $child['link']['href'];
$nid = str_replace('node/','',$child['link']['link_path']);
$test = node_load($nid);


 ?>
 
<div role="tabpanel" class="tab-pane" id="<?php echo strtolower(str_replace(' ','_',$title)); ?>">
<?php
echo $test->body['und']['0']['value'];
?>
</div>
<?php   } ?>
      </div>
   
   
    </div>
  <div class="col-lg-2 col-md-2 col-sm-0 col-xs-0"> </div>
  </div>
<?php break;



}
 ?>
<?php
}
?>


<?php
foreach($node->menu_node_links as $nodes)
{
if($nodes->has_children == '0' )
{ ?>
<div class="container main-container">
  <div class="row">
    <div class="col-lg-18 col-md-24 col-sm-24 col-xs-24">




<h2 class="featured-service-title"><?php echo $node->title; ?> </h2>
<?php echo $node->body['und'][0]['value'];

 
     ?>
    </div>
    <div class="col-lg-6 col-md-5 col-sm-24 col-xs-24 caluclators-tools no-top-margin alpha">
      <!--<h3>Caluclators and Tools</h3>-->
      <h2 class="featured-service-title">Caluclators</h2>
      <div class="caluclators-tools-content"></div>
    </div>
  </div>
</div>
<?php
break;
}
}
?>
<?php
/*
foreach($node->menu_node_links as $nodes)
{
if($nodes->menu_name == 'menu-sdfcu-menu' && $nodes->has_children == '0' )
{
echo $node->body['und'][0]['value'];
break;
}
}  */
?>

 <div class="services">
  <?php print render(block_get_blocks_by_region('rates'));  ?>
  </div>
 
  

Template customization

<?php

/**
 * Add body classes if certain regions have content.
 */
function bartik_preprocess_html(&$variables) {
  if (!empty($variables['page']['featured'])) {
    $variables['classes_array'][] = 'featured';
  }

  if (!empty($variables['page']['triptych_first'])
    || !empty($variables['page']['triptych_middle'])
    || !empty($variables['page']['triptych_last'])) {
    $variables['classes_array'][] = 'triptych';
  }

  if (!empty($variables['page']['footer_firstcolumn'])
    || !empty($variables['page']['footer_secondcolumn'])
    || !empty($variables['page']['footer_thirdcolumn'])
    || !empty($variables['page']['footer_fourthcolumn'])) {
    $variables['classes_array'][] = 'footer-columns';
  }

  // Add conditional stylesheets for IE
  drupal_add_css(path_to_theme() . '/css/ie.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'lte IE 7', '!IE' => FALSE), 'preprocess' => FALSE));
  drupal_add_css(path_to_theme() . '/css/ie6.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'IE 6', '!IE' => FALSE), 'preprocess' => FALSE));
}

/**
 * Override or insert variables into the page template for HTML output.
 */
function sdfcu_process_html(&$variables) {
  // Hook into color.module.
  if (module_exists('color')) {
    _color_html_alter($variables);
  }
}

/**
 * Override or insert variables into the page template.
 */
function sdfcu_process_page(&$variables) {
  // Hook into color.module.
  if (module_exists('color')) {
    _color_page_alter($variables);
  }
  // Always print the site name and slogan, but if they are toggled off, we'll
  // just hide them visually.
  $variables['hide_site_name']   = theme_get_setting('toggle_name') ? FALSE : TRUE;
  $variables['hide_site_slogan'] = theme_get_setting('toggle_slogan') ? FALSE : TRUE;
  if ($variables['hide_site_name']) {
    // If toggle_name is FALSE, the site_name will be empty, so we rebuild it.
    $variables['site_name'] = filter_xss_admin(variable_get('site_name', 'Drupal'));
  }
  if ($variables['hide_site_slogan']) {
    // If toggle_site_slogan is FALSE, the site_slogan will be empty, so we rebuild it.
    $variables['site_slogan'] = filter_xss_admin(variable_get('site_slogan', ''));
  }
  // Since the title and the shortcut link are both block level elements,
  // positioning them next to each other is much simpler with a wrapper div.
  if (!empty($variables['title_suffix']['add_or_remove_shortcut']) && $variables['title']) {
    // Add a wrapper div using the title_prefix and title_suffix render elements.
    $variables['title_prefix']['shortcut_wrapper'] = array(
      '#markup' => '<div class="shortcut-wrapper clearfix">',
      '#weight' => 100,
    );
    $variables['title_suffix']['shortcut_wrapper'] = array(
      '#markup' => '</div>',
      '#weight' => -99,
    );
    // Make sure the shortcut link is the first item in title_suffix.
    $variables['title_suffix']['add_or_remove_shortcut']['#weight'] = -100;
  }
}

/**
 * Implements hook_preprocess_maintenance_page().
 */
function sdfcu_preprocess_maintenance_page(&$variables) {
  // By default, site_name is set to Drupal if no db connection is available
  // or during site installation. Setting site_name to an empty string makes
  // the site and update pages look cleaner.
  // @see template_preprocess_maintenance_page
  if (!$variables['db_is_active']) {
    $variables['site_name'] = '';
  }
  drupal_add_css(drupal_get_path('theme', 'sdfcu') . '/css/maintenance-page.css');
}

/**
 * Override or insert variables into the maintenance page template.
 */
function sdfcu_process_maintenance_page(&$variables) {
  // Always print the site name and slogan, but if they are toggled off, we'll
  // just hide them visually.
  $variables['hide_site_name']   = theme_get_setting('toggle_name') ? FALSE : TRUE;
  $variables['hide_site_slogan'] = theme_get_setting('toggle_slogan') ? FALSE : TRUE;
  if ($variables['hide_site_name']) {
    // If toggle_name is FALSE, the site_name will be empty, so we rebuild it.
    $variables['site_name'] = filter_xss_admin(variable_get('site_name', 'Drupal'));
  }
  if ($variables['hide_site_slogan']) {
    // If toggle_site_slogan is FALSE, the site_slogan will be empty, so we rebuild it.
    $variables['site_slogan'] = filter_xss_admin(variable_get('site_slogan', ''));
  }
}

/**
 * Override or insert variables into the node template.
 */
function sdfcu_preprocess_node(&$variables) {
  if ($variables['view_mode'] == 'full' && node_is_page($variables['node'])) {
    $variables['classes_array'][] = 'node-full';
foreach (array('rates') as $region) {
      $variables[$region] = theme('blocks', $region);
    }
      return $variables;
  }
}

/**
 * Override or insert variables into the block template.
 */
function sdfcu_preprocess_block(&$variables) {
  // In the header region visually hide block titles.
  if ($variables['block']->region == 'header') {
    $variables['title_attributes_array']['class'][] = 'element-invisible';
  }
}

/**
 * Implements theme_menu_tree().
 */
function sdfcu_menu_tree($variables) {
  return '<ul>' . $variables['tree'] . '</ul>';
}


function sdfcu_menu_tree__menu_footer_top_menu(&$variables) {

  return '<ul>' . $variables['tree'] . '</ul>';
}


function sdfcu_menu_link__menu_sdfcu_menu($variables)
{
  $element = $variables['element'];
  $sub_menu = '';

  if ($element['#below']) {
    $sub_menu = drupal_render($element['#below']);
  }
  $output = l($element['#title'], $element['#href'], $element['#localized_options']);
 
  // This example is adds the depth class just for a specific menu. Change 'menu-name' to your menu name.
  if ($element['#original_link']['menu_name'] == 'menu-sdfcu-menu') {
if($element['#original_link']['depth'] == 2)
  {
  $class1 = strtolower(str_replace(' ','-',$element['#original_link']['link_title']));
  $class = str_replace('?','',$class1). " menu-level-2";
  return '<li class="'.$class.'">' . $output . $sub_menu . "</li>\n";
  }
if($element['#original_link']['depth'] == 1)
  {
  $class1 = strtolower(str_replace(' ','-',$element['#original_link']['link_title']));
  $class = $class1. " dropdown";
 
  return '<li class="'.$class.'">' . $output .'<b class="caret"></b>'. $sub_menu . '</li>';
 
  }
  if($element['#original_link']['depth'] == 2)
  {
  $class1 = strtolower(str_replace(' ','-',$element['#original_link']['link_title']));
  $class = str_replace('?','',$class1). " menu-level-2";
  return '<li class="'.$class.'">' . $output . $sub_menu . "</li>\n";
  }
if($element['#original_link']['depth'] == 3)
  {
  $class1 = strtolower(str_replace(' ','-',$element['#original_link']['link_title']));
  $class = str_replace('?','',$class1). " menu-level-3";
  return '<li class="'.$class.'">' . $output . $sub_menu . "</li>\n";
  }
if($element['#original_link']['depth'] == 4)
  {
  $class1 = strtolower(str_replace(' ','-',$element['#original_link']['link_title']));
  $class = str_replace('?','',$class1). " menu-level-4";
  return '<li class="'.$class.'">' . $output . $sub_menu . "</li>\n";
  }  
  else {
    return '<li>' . $output . $sub_menu . "</li>\n";
  }

}
  }
 




function sdfcu_menu_link__menu_footer_top_menu($variables)
{
  $element = $variables['element'];
  $sub_menu = '';

  $element['#attributes']['class'][] = 'menu-' . $element['#original_link']['mlid'];

  if ($element['#below']) {
    $sub_menu = drupal_render($element['#below']);
  }
  $output = l($element['#title'], $element['#href'], $element['#localized_options']);
  return '<li class="col-lg-4 col-md-4 col-sm-12 col-xs-12">' . $output . $sub_menu . '</li>';
}

function sdfcu_menu_link__menu_footer_menu($variables)
{
$element = $variables['element'];
  $sub_menu = '';
 
if ($element['#below']) {
    $sub_menu = drupal_render($element['#below']);
  }
    $element = $variables['element'];
$output = l($element['#title'], $element['#href'], $element['#localized_options']);
if($element['#original_link']['depth'] == 1)
{
return '<li class="col-lg-4 col-md-4 col-sm-12 col-xs-12">' . $output . $sub_menu . '</li>';
}

else
{
return '<li>' . $output . $sub_menu . '</li>';
}
}

/**
 * Implements theme_field__field_type().
 */
function sdfcu_field__taxonomy_term_reference($variables) {
  $output = '';

  // Render the label, if it's not hidden.
  if (!$variables['label_hidden']) {
    $output .= '<h3 class="field-label">' . $variables['label'] . ': </h3>';
  }

  // Render the items.
  $output .= ($variables['element']['#label_display'] == 'inline') ? '<ul class="links inline">' : '<ul class="links">';
  foreach ($variables['items'] as $delta => $item) {
    $output .= '<li class="taxonomy-term-reference-' . $delta . '"' . $variables['item_attributes'][$delta] . '>' . drupal_render($item) . '</li>';
  }
  $output .= '</ul>';

  // Render the top-level DIV.
  $output = '<div class="' . $variables['classes'] . (!in_array('clearfix', $variables['classes_array']) ? ' clearfix' : '') . '"' . $variables['attributes'] .'>' . $output . '</div>';

  return $output;
}


function sdfcu_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'search_block_form') {
 
    $form['search_block_form']['#title'] = t('Search'); // Change the text on the label element
    $form['search_block_form']['#title_display'] = 'invisible'; // Toggle label visibilty
    $form['search_block_form']['#size'] = 40;  // define size of the textfield
    $form['search_block_form']['#default_value'] = t('Search'); // Set a default value for the textfield
    $form['actions']['submit']['#value'] = t('GO!'); // Change the text on the submit button
    $form['actions']['submit'] = array('#type' => 'image_button', '#src' => base_path() . path_to_theme() . '/images/search-ico.png');

$form['search_block_form']['#prefix']= '<li class="search">';
$form['search_block_form']['#suffix']= "</li>";
    // Add extra attributes to the text box
    $form['search_block_form']['#attributes']['onblur'] = "if (this.value == '') {this.value = 'Search';}";
    $form['search_block_form']['#attributes']['onfocus'] = "if (this.value == 'Search') {this.value = '';}";
    // Prevent user from searching the default text
    $form['#attributes']['onsubmit'] = "if(this.search_block_form.value=='Search'){ alert('Please enter a search'); return false; }";

    // Alternative (HTML5) placeholder attribute instead of using the javascript
    $form['search_block_form']['#attributes']['placeholder'] = t('Search');
  }
 
 
}




  // Helper function used below.
  function _menu_subtree_data($item, $tree) {
    foreach ($tree as $cid => $data) {
      if ($item['mlid'] == $data['link']['mlid']) {
        return array($cid => $data);
      }

      if ($data['below']) {
        $return = _menu_subtree_data($item, $data['below']);
        if ($return) {
          return $return;
        }
      }
    }
    return FALSE;
  }