Assigning new region in a display suite layout does not show contents placed inside newly created region

drupal.stackexchange https://drupal.stackexchange.com/questions/274760

  •  06-02-2021
  •  | 
  •  

// rmch-content-2.tpl.php
<?php
/**
 * @file
 * Display Suite RMCH Two Column Header template.
 *
 * Available variables:
 *
 * Layout:
 * - $classes: String of classes that can be used to style this layout.
 * - $contextual_links: Renderable array of contextual links.
 * - $layout_wrapper: wrapper surrounding the layout.
 *
 * Regions:
 *
 * - $header: Rendered content for the "Header" region.
 * - $header_classes: String of classes that can be used to style the "Header" region.
 *
 * - $left: Rendered content for the "Left" region.
 * - $left_classes: String of classes that can be used to style the "Left" region.
 *
 * - $right: Rendered content for the "Right" region.
 * - $right_classes: String of classes that can be used to style the "Right" region.
 */
?>
<<?php print $layout_wrapper; print $layout_attributes; ?> class="<?php print $classes;?> clearfix">

  <!-- Needed to activate contextual links -->
  <?php if (isset($title_suffix['contextual_links'])): ?>
    <?php print render($title_suffix['contextual_links']); ?>
  <?php endif; ?>

  <div class="l-content themed-content">
    <div class="inner">    
      <<?php print $content_left_wrapper; ?> class="ds-content-left <?php print $content_left_classes; ?>">
        <?php print $content_left; ?>
      </<?php print $content_left_wrapper; ?>>

      <<?php print $content_right_wrapper; ?> class="ds-content-right <?php print $content_right_classes; ?>">
        <?php print $content_right; ?>
      </<?php print $content_right_wrapper; ?>>
    </div>    
  </div>

   <<?php print $content_right_wrapper; ?> class="ds-content-footer <?php print $content_footer_classes; ?>">
        <?php print $content_footer; ?>
   </<?php print $content_right_wrapper; ?>>

   <div class="page-links">      
    <div class="ds-links">      
      <?php print render(block_get_blocks_by_region('page_links')); ?>      
    </div>    
  </div> 

</<?php print $layout_wrapper ?>>

<!-- Needed to activate display suite support on forms -->
<?php if (!empty($drupal_render_children)): ?>
  <?php print $drupal_render_children ?>
<?php endif; ?>

So I have added new footer region in the .inc for the layout rmch_content_2.inc

/**
 * @file
 * Display Suite RMCH Header 2 col, Content 2 col
 */

function ds_rmch_content_2() {
  return array(
    'label' => t('RMCH Content 2 col'),
    'regions' => array(      
      'content_left' => t('Content Left'),
      'content_right' => t('Content Right'),
      'footer' => t('Footer'),
    ),
    // Uncomment if you want to include a CSS file for this layout (rmch_two_column_header.css)
    'css' => FALSE,
    // Uncomment if you want to include a preview for this layout (rmch_two_column_header.png)
    'image' => TRUE,
  );
}

I have added new region footer which is visible in the screenshot and added Links field inside Footer When I add Links field in the Content Left , it displays links but when I add it in the footer it does not show up and the variable print $content_footer; inside tpl.php file turns out to be empty completely.
What should I do the make sure blocks or fields added inside newly created regions show up.? enter image description here

有帮助吗?

解决方案

You've made a footer definition but printing $content_footer. Try printing $footer or changing the name of the region to be consistent with the others (content_). Clear cache to see your changes.

许可以下: CC-BY-SA归因
scroll top