Skip to content

Instantly share code, notes, and snippets.

View thejimbirch's full-sized avatar

Jim Birch thejimbirch

View GitHub Profile
@thejimbirch
thejimbirch / drupal-paragraph-bootstrap-carousel.html.twig
Last active October 16, 2016 11:21
Drupal Paragraph Twig Template for creating a Bootstrap Carousel
@thejimbirch
thejimbirch / select.html.twig
Created August 18, 2016 22:51
Styling Exposed View Forms in Drupal 8 - Twig Template
{#
/**
* @file
* Theme override for a select element.
*
* Available variables:
* - attributes: HTML attributes for the select tag.
* - options: The option element children.
*
* @see template_preprocess_select()
@thejimbirch
thejimbirch / exposed-view-form-styling-customized.less
Last active June 9, 2020 18:53
Styling Exposed View Forms in Drupal 8
/* More customized to actual project. Added Row and Columns to elements to make them more responsive */
/* Exposed Views Form */
.views-exposed-form {
/* Adds separation between filter of results */
.make-row();
/* Floats Label to the left and aligns */
label {
.text-muted();
/* -------------------------------------------------------------------------- */
/* Base Paragraph Styling. This is the BEM Block */
/* -------------------------------------------------------------------------- */
.element {
padding-top: @jumbotron-padding;
.make-sm-column(10);
.make-sm-column-offset(1);
.make-md-column(8);
.make-md-column-offset(2);
{%- for item in items -%}
<div class="element--layout-columns__{{ loop.length }}col">{{ item.content }}</div>
{%- endfor -%}
@thejimbirch
thejimbirch / drupal-paragraph-multi-column.html.twig
Last active August 15, 2016 02:36
Simple Drupal Paragraph Template - Example Filename would be paragraph--MACHINE-NAME.html.twig
<div class="element element--layout-columns">
{{ content }}
</div>
@thejimbirch
thejimbirch / Bootstrap Drupal 8 Tabs - menu-local-task.html.twig
Last active February 26, 2017 23:42
Add these two files to your Bootstrap enambled theme at themes/custom/THEME/templates/navigation/
<li{{ attributes.addClass(is_active ? 'active') }}>{{ link }}</li>
{{ menus.menu_links(items, attributes, 0) }}
{% macro menu_links(items, attributes, menu_level) %}
{% import _self as menus %}
{% if items %}
{% if menu_level == 0 %}
<ul class="nav navbar-nav">
{% else %}
<ul class="nav navbar-nav">
{% endif %}
<div id="navbar" class="collapse navbar-collapse">
{{ content }}
</div>
{% block content %}
{% if site_logo %}
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
Menu
</button>
<a class="navbar-brand" href="{{ path('<front>') }}" title="{{ site_name }}" rel="home">
<img src="{{ site_logo }}" alt="{{ site_name }}" />
</a>