I have created a sub-theme of Zurb-Foundation and the front-end displays very well. In fact, I didn't realize I had a problem until I looked at the site reports. I originally thought the issue was a Drupal core problem because the errors point to type: php, and the messages point to core elements.
I get dozens of these errors when I refresh a browser page:
Notice: Array to string conversion in Drupal\Core\Asset\AssetResolver->getLibrariesToLoad() (line 110 of /Users/brett/vhosts/ddclab/core/lib/Drupal/Core/Asset/AssetResolver.php).
I also get a couple of these errors too:
Warning: explode() expects parameter 2 to be string, array given in Drupal\Core\Asset\LibraryDependencyResolver->doGetDependencies() (line 58 of /Users/brett/vhosts/ddclab/core/lib/Drupal/Core/Asset/LibraryDependencyResolver.php).
Being pretty new to Drupal I'm at a complete loss trying to figure out what is causing the problem. I have added several regions in both the page.html.twig and the theme.info.yml file. Everything displays correctly and the regions are recognized, but I can't figure out what is causing these errors. I am going to paste the content of my sub-theme files for reference:
ddc_f5.info.yml:
name: ddc_f5
description: "This is a DDC lab F5 sub-theme, inherits from the Foundation base theme read <a href=\"http://foundation.zurb.com/docs/index.php\">framework documentation</a>"
core: 8.x
type: theme
base theme: zurb_foundation
# Image appears on admin/appearance
# screenshot: images/screenshot.jpg
# Uncomment these lines and change "STARTER" to your theme name if you
# need to add custom CSS or JS
libraries:
- ddc_f5/global
- ddc_f5/css/print.css { media: print }
# Regions are output in the page.html.twig
regions:
meta_header: 'Meta Header'
header: Header
help: Help
page_top: 'Page top'
page_bottom: 'Page bottom'
define: 'Defining'
highlighted: Highlighted
content: Content
sidebar_first: 'Left Sidebar'
sidebar_second: 'Right Sidebar'
triple_left: 'Triple left'
triple_middle: 'Triple middle'
triple_right: 'Triple right'
double_left: 'Double left'
double_right: 'Double right'
searching: 'Search bar'
footer_first: 'Footer first column'
footer_middle: 'Footer middle column'
footer_last: 'Footer last column'
left_off_canvas: 'Left off canvas'
right_off_canvas: 'Right off canvas'
regions_hidden:
# page_top: 'Page Top'
# page_bottom: 'Page bottom'
# Hidden regions
# regions_hidden[]: Page top
# regions_hidden[]: Page bottom
features:
- logo
- name
- slogan
- favicon
ddc_f5.libraries.yml:
global:
version: VERSION
css:
theme:
css/ddc_f5.css: {}
css/print.css: { media: print }
js:
js/ddc_f5.js: {}
dependencies:
- core/drupal
- core/jquery
theme-setting.php:
<?php
/**
* Implements hook_form_FORM_ID_alter().
*
* @param $form
* The form.
* @param $form_state
* The form state.
*/
function ddc_f5_form_system_theme_settings_alter(&$form, &$form_state) {
}
ddc_f5.theme:
<?php
// Add your custom theme override functions here.
/**
* Implements hook_preprocess_block()
*/
function ddc_f5_preprocess_block(&$variables) {
}
/**
* Implements template_preprocess_field().
*/
function ddc_f5_preprocess_field(&$variables) {
}
/**
* Implements template_preprocess_html().
*
* Adds additional classes
*/
function ddc_f5_preprocess_html(&$variables) {
}
/**
* Implements template_preprocess_node
*
* Add template suggestions and classes
*/
function ddc_f5_preprocess_node(&$variables) {
}
/**
* Implements template_preprocess_page
*
* Add convenience variables and template suggestions
*/
function ddc_f5_preprocess_page(&$variables) {
}
/**
* Implements template_preprocess_views_view().
*/
function ddc_f5_preprocess_views_view(&$variables) {}
// Dynamic sidebars
if (!empty($left) && !empty($right)) {
$variables['main_grid'] = 'medium-12 large-6 large-push-3';
$variables['sidebar_first_grid'] = 'medium-6 large-3 large-pull-6';
$variables['sidebar_sec_grid'] = 'medium-6 large-3';
}
elseif (empty($left) && !empty($right)) {
$variables['main_grid'] = 'large-9';
$variables['sidebar_first_grid'] = '';
$variables['sidebar_sec_grid'] = 'large-3';
}
elseif (!empty($left) && empty($right)) {
$variables['main_grid'] = 'large-9 large-push-3';
$variables['sidebar_first_grid'] = 'large-3 large-pull-9';
$variables['sidebar_sec_grid'] = '';
}
else {
$variables['main_grid'] = 'large-12';
$variables['sidebar_first_grid'] = '';
$variables['sidebar_sec_grid'] = '';
}
Finally page.html.twig:
<section class="off-canvas-wrap" data-offcanvas>
<div class="inner-wrap">
<aside class="left-off-canvas-menu">
{{ page.left_off_canvas }}
</aside>
<aside class="right-off-canvas-menu">
{{ page.right_off_canvas }}
</aside>
{% if page.meta_header %}
{% if meta_header_grid %}
<div class="row">
<div class="large-12 columns">
{% endif %}
{{ page.meta_header }}
{% if meta_header_grid %}
</div>
</div>
{% endif %}
{% endif %}
<div id="testhead">
<header class="row">
{% if linked_site_name or linked_logo %}
<div class="large-2 columns">
{% if linked_logo %}
{{ linked_logo }}
{% endif %}
</div>
<div class="large-4 columns">
{% if is_front %}
<h1 id="site-name">{{ linked_site_name }}</h1>
{% else %}
<div id="site-name">{{ linked_site_name }}</div>
{% endif %}
</div>
{% endif %}
</header>
{% if page.header %}
<div class="row">
<div class="large-12 columns">
{{ page.header }}
</div>
</div>
{% endif %}
</div> {# end #testhead #}
<div class="row">
{% if show_account_info %}
<div class="{{ site_slogan ? 'large-6' : 'large-4 columns large-offset-8' }} columns hide-for-small">
<p>
{% if logged_in %}
<a href="{{ path('user.page') }}">{{ 'My Account'|t }}</a>
<a href="{{ path('user.logout') }}">{{ 'Logout'|t }}</a>
{% else %}
<a href="{{ path('user.login') }}">{{ 'Login'|t }}</a>
<a href="{{ path('user.register') }}">{{ 'Sign Up'|t }}</a>
{% endif %}
</p>
</div>
{% endif %}
{% if site_slogan %}
<div class="large-6 columns hide-for-small">
{{ site_slogan }}
</div>
{% endif %}
{% if show_account_info %}
<div class="show-for-small">
<div class="six mobile-two columns">
<p>
<a href="{{ path('user.login') }}" class="radius button">{{ 'Login'|t }}</a>
</p>
</div>
<div class="six mobile-two columns">
<p>
<a href="{{ path('user.register') }}" class="radius success button">{{ 'Sign Up'|t }}</a>
</p>
</div>
</div>
{% endif %}
</div>
{% if messages and not zurb_foundation_messages_modal %}
<div class="l-messages row">
<div class="large-12 columns">
{{ messages }}
</div>
</div>
{% endif %}
<div id="navi">
<div class="row">
{% if page.help %}
<div class="l-help row">
<div class="large-12 columns">
{{ page.help }}
</div>
</div>
{% endif %}
</div>
</div>
{% if is_front %}
<div id="defining">
<div id="bimage" class="bannerimg">
{% if page.define %}
<div class="define">
{{page.define}}
</div>
{% endif %}
</div>
</div>
{% endif %}
<div id="contentblock">
<div class="row maincontent">
<div id="main" class="{{ main_grid }} columns">
<a id="main-content"></a>
{% if breadcrumb %} {{ breadcrumb }} {% endif %}
{% if title and not is_front %}
{{ title_prefix }}
<h1 id="page-title" class="title">{{ title }}</h1>
{{ title_suffix }}
{% endif %}
{% if tabs %}
{{ tabs }}
{% if tabs2 %} {{ tabs2 }} {% endif %}
{% endif %}
{% if action_links %}
<ul class="action-links">
{{ action_links }}
</ul>
{% endif %}
{% if is_front %}
<div class="small-10 small-push-1 tripart">
{% if page.triple_left %}
<div id="triple_left" class="triples medium-4 columns">
{{page.triple_left}}
</div>
{% endif %}
{% if page.triple_middle %}
<div id="triple_middle" class="triples medium-4 columns">
{{page.triple_middle}}
</div>
{% endif %}
{% if page.triple_right %}
<div id="triple_right" class="triples medium-4 columns">
{{page.triple_right}}
</div>
{% endif %}
</div>
{% endif %}
{{ page.content }}
</div> {# end #main #}
{% if page.sidebar_first %}
<div id="sidebar-first" class="{{ sidebar_first_grid }} columns sidebar ">
{{ page.sidebar_first }}
</div>
{% endif %}
{% if page.sidebar_second %}
<div id="sidebar-second" class="{{ sidebar_sec_grid }} columns sidebar">
{{ page.sidebar_second }}
</div>
{% endif %}
</div> {# end .row #}
</div> {# end #contentblock #}
{% if is_front %}
<div id="searchbar">
<div class="row">
<div class="searchform small-centered text-center">
{% if page.searching %}
{{ page.searching }}
{% endif %}
</div>
</div> {# end .row #}
</div>
{% endif %}
<div id="twins">
<div class="row">
<div class="small-10 small-push-1">
{% if page.double_left %}
<div class="doubles medium-6 columns">
{{ page.double_left }}
</div>
{% endif %}
{% if page.double_right %}
<div class="doubles medium-6 columns">
{{ page.double_right }}
</div>
{% endif %}
</div>
</div>{# end .row #}
</div> {# end #twins #}
{% if page.footer_first or page.footer_middle or page.footer_last %}
<div id="testfoot">
<footer class="row">
{% if page.footer_first %}
<div id="footer-first" class="medium-4 columns">
{{ page.footer_first }}
</div>
{% endif %}
{% if page.footer_middle %}
<div id="footer-middle" class="medium-4 columns">
{{ page.footer_middle }}
</div>
{% endif %}
{% if page.footer_last %}
<div id="footer-last" class="medium-4 columns">
{{ page.footer_last }}
</div>
{% endif %}
</footer>
</div> {# end #testfoot #}
{% endif %}
<div class="bottom-bar panel">
<div class="row">
<div class="large-12 columns">
© {{ "now"|date('Y') }} {{ site_name }} {{ 'All rights reserved.'|t }}
</div>
</div>
</div>
<a class="exit-off-canvas"></a>
</div>
</section>
I hope someone can spot the problem and help me solve this puzzle. Thanks very much in advance.
Comments
Edit your post to correctly
Edit your post to correctly use the code or php tags.
Pimp your Drupal 8 Toolbar - make it badass.
Adaptivetheme - theming system for people who don't code.
Thanks.
I have placed all code, etc. in code brackets. Sorry for the inconvenience.
Error in info yml
should be:
There may be others, start with correcting this mistake.
Pimp your Drupal 8 Toolbar - make it badass.
Adaptivetheme - theming system for people who don't code.
That was it. Thanks!
Hi Jeff,
Thanks for taking the time to help. I removed that line and the errors went away.
Thanks very much.