Skip to content

Instantly share code, notes, and snippets.

@SebCorbin
Last active July 8, 2021 09:50
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SebCorbin/2297f50b79d1c676eb04 to your computer and use it in GitHub Desktop.
Save SebCorbin/2297f50b79d1c676eb04 to your computer and use it in GitHub Desktop.
Drupal Bootstrap theme main templates converted to Twig
<section id="{{ block_html_id }}" class="{{ classes }} clearfix"{{ attributes }}>
{{ title_prefix }}
{% if title %}
<h2{{ title_attributes }}>{{ title }}</h2>
{% endif %}
{{ title_suffix }}
{{ content }}
</section>
<div{{ attributes }}>
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title">{{ heading }}</h4>
</div>
<div class="modal-body">{{ body }}</div>
<div class="modal-footer">{{ footer }}</div>
</div>
</div>
</div>
<!DOCTYPE html>
<html lang="{{ language.language }}" dir="{{ language.dir }}"{{ rdf_namespaces }}>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{{ head }}
<title>{{ head_title }}</title>
{{ styles }}
<!-- HTML5 element support for IE6-8 -->
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
{{ scripts }}
</head>
<body class="{{ classes }}" {{ attributes }}>
{{ page_top }}
{{ page }}
{{ page_bottom }}
</body>
</html>
<header id="navbar" role="banner" class="{{ navbar_classes }}">
<div class="container">
<div class="navbar-header">
{% if logo %}
<a class="logo navbar-btn pull-left" href="{{ front_page }}" title="{{ 'Home'|t }}">
<img src="{{ logo }}" alt="{{ 'Home'|t }}"/>
</a>
{% endif %}
{% if site_name %}
<a class="name navbar-brand" href="{{ front_page }}" title="{{ 'Home'|t }}">{{ site_name }}</a>
{% endif %}
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
{% if primary_nav or secondary_nav or page.navigation %}
<div class="navbar-collapse collapse">
<nav role="navigation">
{{ primary_nav }}
{{ secondary_nav }}
{{ page.navigation }}
</nav>
</div>
{% endif %}
</div>
</header>
<div class="main-container container">
<header role="banner" id="page-header">
{% if site_slogan %}
<p class="lead">{{ site_slogan }}</p>
{% endif %}
{{ page.header }}
</header>
<!-- /#page-header -->
<div class="row">
{% if page.sidebar_first %}
<aside class="col-sm-3" role="complementary">
{{ page.sidebar_first }}
</aside> <!-- /#sidebar-first -->
{% endif %}
<section{{ content_column_class }}>
{% if page.highlighted %}
<div class="highlighted jumbotron">{{ page.highlighted }}</div>
{% endif %}
{{ breadcrumb }}
<a id="main-content"></a>
{{ title_prefix }}
{% if title %}
<h1 class="page-header">{{ title }}</h1>
{% endif %}
{{ title_suffix }}
{{ messages }}
{{ tabs }}
{{ page.help }}
{% if action_links %}
<ul class="action-links">{{ action_links }}</ul>
{% endif %}
{{ page.content }}
</section>
{% if page.sidebar_second %}
<aside class="col-sm-3" role="complementary">
{{ page.sidebar_second }}
</aside> <!-- /#sidebar-second -->
{% endif %}
</div>
</div>
<footer class="footer container">
{{ page.footer }}
</footer>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment