From 411b23fd286fc9cf02df3ac0e7fe93d66744804e Mon Sep 17 00:00:00 2001
From: awdstudio <awdstudio@2427420.no-reply.drupal.org>
Date: Thu, 26 Apr 2018 23:29:03 -0500
Subject: [PATCH] Issue #2892364 by brandonratz, AWD Studio, Pawelgorski87,
 krina.addweb, hatuhay: Undefined index in
 bootstrap_barrio_preprocess_form_element

---
 bootstrap_barrio.layouts.yml            | 10 +++++++++
 bootstrap_barrio.theme                  | 18 +++++++++--------
 templates/content/page-title.html.twig  |  2 +-
 templates/ds/layout--ds-media.html.twig | 27 +++++++++++++++++++++++++
 templates/layout/page-title.html.twig   | 16 ---------------
 templates/layout/page.html.twig         |  4 +---
 6 files changed, 49 insertions(+), 28 deletions(-)
 create mode 100644 templates/ds/layout--ds-media.html.twig
 delete mode 100644 templates/layout/page-title.html.twig

diff --git a/bootstrap_barrio.layouts.yml b/bootstrap_barrio.layouts.yml
index f6565f5..c3eee85 100644
--- a/bootstrap_barrio.layouts.yml
+++ b/bootstrap_barrio.layouts.yml
@@ -50,3 +50,13 @@ bb_card3stack:
       label: Image
     third:
       label: Second
+bb_media:
+  label: Media
+  category: Barrio
+  template: templates/ds/layout--ds-media
+  class: '\Drupal\ds\Plugin\DsLayout'
+  regions:
+    first:
+      label: Image
+    second:
+      label: Content
diff --git a/bootstrap_barrio.theme b/bootstrap_barrio.theme
index 5298363..281f75c 100644
--- a/bootstrap_barrio.theme
+++ b/bootstrap_barrio.theme
@@ -310,14 +310,16 @@ function bootstrap_barrio_preprocess_block(&$variables) {
 }
 
 function bootstrap_barrio_preprocess_form_element(&$variables) {
-  if ( is_object($variables['label']['#title']) && !$variables['label']['#title'] instanceof \Drupal\Component\Render\MarkupInterface) {
-    $variables['input_title'] = NULL;
-  }
-  elseif ( is_object($variables['label']['#title']) ) {
-    $variables['input_title'] = $variables['label']['#title'];
-  }
-  else {
-    $variables['input_title'] = $variables['label']['#title'];
+  if (isset($variables['label']['#title'])) {
+    if ( is_object($variables['label']['#title']) && !$variables['label']['#title'] instanceof \Drupal\Component\Render\MarkupInterface) {
+      $variables['input_title'] = NULL;
+    }
+    elseif ( is_object($variables['label']['#title']) ) {
+      $variables['input_title'] = $variables['label']['#title'];
+    }
+    else {
+      $variables['input_title'] = $variables['label']['#title'];
+    }
   }
   if (isset($variables['element']['#attributes'])) {
     $variables['input_attributes'] = new Attribute($variables['element']['#attributes']);
diff --git a/templates/content/page-title.html.twig b/templates/content/page-title.html.twig
index adec853..0d94062 100644
--- a/templates/content/page-title.html.twig
+++ b/templates/content/page-title.html.twig
@@ -16,6 +16,6 @@
 #}
 {{ title_prefix }}
 {% if title %}
-  <h1{{ title_attributes.addClass('page-title') }}>{{ title }}</h1>
+  <h1{{ title_attributes.addClass('title') }}>{{ title }}</h1>
 {% endif %}
 {{ title_suffix }}
diff --git a/templates/ds/layout--ds-media.html.twig b/templates/ds/layout--ds-media.html.twig
new file mode 100644
index 0000000..3e330fa
--- /dev/null
+++ b/templates/ds/layout--ds-media.html.twig
@@ -0,0 +1,27 @@
+{#
+/**
+ * @file
+ * Display Suite media.
+ *
+ * Available variables:
+ * - outer_wrapper: outer wrapper element
+ * - first_wrapper: wrapper element around first region
+ * - second_wrapper: wrapper element around second region
+ * - attributes: layout attributes
+ * - first_attributes: attributes for first region
+ * - second_attributes: attributes for second region
+ * - first: content of first region
+ * - second: content of second region
+ */
+#}
+<{{ outer_wrapper }}{{ attributes.addClass('media', 'clearfix') }}>
+
+  {{ title_suffix.contextual_links }}
+
+  {{ first }}
+
+  <{{ second_wrapper }}{{ second_attributes.addClass('media-body') }}>
+    {{ second }}
+  </{{ second_wrapper }}>
+
+</{{ outer_wrapper }}>
diff --git a/templates/layout/page-title.html.twig b/templates/layout/page-title.html.twig
deleted file mode 100644
index e061cd2..0000000
--- a/templates/layout/page-title.html.twig
+++ /dev/null
@@ -1,16 +0,0 @@
-{% extends "@classy/content/page-title.html.twig" %}
-{#
-/**
- * @file
- * Bartik's theme implementation for a page title.
- *
- * Available variables:
- * - title_attributes: HTML attributes for the page title element.
- * - title_prefix: Additional output populated by modules, intended to be
- *   displayed in front of the main title tag that appears in the template.
- * - title: The page title, for use in the actual content.
- * - title_suffix: Additional output populated by modules, intended to be
- *   displayed after the main title tag that appears in the template.
- */
-#}
-{% set title_attributes = title_attributes.addClass('title') %}
diff --git a/templates/layout/page.html.twig b/templates/layout/page.html.twig
index 19052c7..5e1e96b 100644
--- a/templates/layout/page.html.twig
+++ b/templates/layout/page.html.twig
@@ -135,9 +135,7 @@
       {% block content %}
         <div id="main" class="{{ container }}">
           {% if page.breadcrumb %}
-            <div class="row">
-              {{ page.breadcrumb }}
-            </div>
+            {{ page.breadcrumb }}
           {% endif %}
           <div class="row row-offcanvas row-offcanvas-left clearfix">
               <main{{ content_attributes }}>
-- 
GitLab