Tuesday, August 6, 2019

How to make Drupal 8 Page.html.twig format



NPSB


<div class="wrapper">
  <main class="background_container"> 
  {% if page.header_image|render %} 
    <div class="inner_banner">
      {{ page.header_image }}
    </div>
    {% else %}
    <div class="inner_banner">
      <img src="{{ base_path ~ directory }}/images/inner_banner.jpg" width="2000" height="741">
    </div>
  {% endif %} 
    <section class="main_heading">
      <h2 class="hide"> &ensp;</h2>
        <div class="container">
          <div class="row">
            <div class="col-md-12">
              <div class="page-title">
                {{ page.page_title }}
              </div>
            </div>
          </div>
        </div>
    </section>
    <section class="internal_pages">
      <h2 class="hide"> &ensp;</h2>
      <div class="container">
        <div class="row">
         {% if page.sidebar_first|render|length > 0 %}
            <div class="col-md-9 col-sm-9 in_main">           

              {% else %}
               <div class="col-xs-12 col-sm-12 in_main"> 
                {% endif %}      
                 <div class="layout-content">

                  {{ page.content }}
                </div>
              </div>
              {% if page.sidebar_first|render %}
              <div class="col-md-3 col-sm-3 side_bar">      
                 <aside class="layout-sidebar-first" role="complementary">
                  {{ page.sidebar_first }}
                </aside>    

            </div>
            {% endif %}                
            <!-- </div> -->
        </div>
      </div>
    </section>
  </main>

</div>


bissette
<section class="about_sec">
      <h2 class="hide"> &ensp;</h2>
      <div class="container">
        <div class="row"> 
        {% if page.sidebar_first %}
          <div class="col-xs-9 col-sm-9 page-content">           
            {% else %}
             <div class="col-xs-12 col-sm-12 in_main">
              {% endif %}      
               <div class="layout-content">
                {{ page.content }}
              </div>
            </div>
            {% if page.sidebar_first %}
            <div class="col-md-3 col-sm-3 side_wrap">      
               <aside class="layout-sidebar-first" role="complementary">
                {{ page.sidebar_first }}
              </aside>    
          </div>
          {% endif %}                
        </div>
       </div>
      </div>
    </section>
kids
<div class="row">
           {% if page.sidebar_first %}
              <div class="col-sm-8" data-aos="zoom-out-up">           
                {% else %}
                <div class="col-xs-12 col-sm-12" data-aos="zoom-out-up">
                  {% endif %}      
                      <div class="tabs">
                       {{ page.tabs }}
                     </div>
                    <div class="layout-content">
                      {{ page.content }}
                    </div>
                  </div>
            {% if page.sidebar_first %}
            <div class="col-sm-3 col-sm-push-1">
              <div class="side_bar about_links">
               <aside class="layout-sidebar-first" role="complementary">
                {{ page.sidebar_first }}
              </aside>
            </div>
          </div>
          {% endif %}
          </div>
        </div>
move











<div class="container-fluid slant inner-page-section">
<div class="row">
<div class="container">
<div class="row">
{% if page.sidebar_first|render|striptags|trim|length > 0 %}
<aside class="sidebar-first sidebar col-lg-3 col-md-3 col-sm-12 col-xs-12" role="complementary">
  {{ page.sidebar_first }}
</aside>
{% endif %}
<div class="content col-lg-{{ page.main_content_width }} col-md-{{ page.main_content_width }} col-sm-12 col-xs-12">
  <div class="col-xs-12 col-sm-12 contact-view-content pad0">
    {{ page.content }}
  </div>
</div>
 {% if page.sidebar_second|render|striptags|trim|length > 0 %}
  <aside class="col-xs-12 col-sm-3 sidebar-right-view newsside-bar" role="complementary">
    {{ page.sidebar_second }}
  </aside>
{% endif %}        
</div>
</div>
</div>
</div>
Themename.theme
function movers_preprocess_page(array &$variables) {

  if (!empty($variables['page']['sidebar_first']) && !empty($variables['page']['sidebar_second'])) {
    $variables['attributes']['class'][] = 'layout-two-sidebars';
    $variables['page']['main_content_width'] = 6;
  }
  elseif (!empty($variables['page']['sidebar_first'])) {
    $variables['attributes']['class'][] = 'layout-one-sidebar';
    $variables['attributes']['class'][] = 'layout-sidebar-first';
    $variables['page']['main_content_width'] = 9;
  }
  elseif (!empty($variables['page']['sidebar_second'])) {
    $variables['attributes']['class'][] = 'layout-one-sidebar';
    $variables['attributes']['class'][] = 'layout-sidebar-second';
    $variables['page']['main_content_width'] = 9;
  }
  else {
    $variables['attributes']['class'][] = 'layout-no-sidebars';
    $variables['page']['main_content_width'] = 12;
  }
}
University

 <section class="internal_pages">
      <h2 class="hide"> &ensp;</h2>
      <div class="container">
        <div class="row">
         {% if page.sidebar_first|render|striptags|trim|length > 0 %}
            <div class="col-md-8 col-sm-8 in_main">           
              {% else %}
               <div class="col-xs-12 col-sm-12 in_main"> 
                {% endif %}      
                 <div class="layout-content">
                  {{ page.content }}
                </div>
              </div>
              {% if page.sidebar_first|render|striptags|trim|length > 0 %}
              <div class="col-md-4 col-sm-4 side_inner">      
                 <aside class="layout-sidebar-first" role="complementary">
                  {{ page.sidebar_first }}
                </aside>    
            </div>
            {% endif %}                
            </div>
        </div>
      </div>
    </section>

No comments:

Post a Comment

If you have any problem please let me know.