backdrop-contrib / views_bootstrap

This module provides a set of styles for the Views module. It allows you to create responsive Bootstrap 3.x components, such as grids, carousels, tabs, and tables, all within the configuration settings of the powerful Views module.
https://backdropcms.org/project/views_bootstrap
GNU General Public License v2.0
0 stars 7 forks source link

Array to string conversion warning on grid style #1

Closed thekenshow closed 6 years ago

thekenshow commented 8 years ago

I was getting an Array to string conversion in include() error caused by a print $classes statement instead of a loop in the main container. Patch below.

From 1646283ed5cfe436efd539955c93af64e98ca2d2 Mon Sep 17 00:00:00 2001
From: Ken Dow <me@kendow.com>
Date: Sat, 16 Jul 2016 09:02:48 -0400
Subject: [PATCH] Fix array conversion error on views_bootstrap grid.

---
 .../views-bootstrap-grid-plugin-style.tpl.php      |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/modules/contrib/views_bootstrap/views-bootstrap-grid-plugin-style.tpl.php b/modules/contrib/views_bootstrap/views-bootstrap-grid-plugin-style.tpl.php
index d6bea6c..11a7613 100755
--- a/modules/contrib/views_bootstrap/views-bootstrap-grid-plugin-style.tpl.php
+++ b/modules/contrib/views_bootstrap/views-bootstrap-grid-plugin-style.tpl.php
@@ -18,7 +18,7 @@
   <h3><?php print $title ?></h3>
 <?php endif ?>

-<div id="views-bootstrap-grid-<?php print $id ?>" class="<?php print $classes ?>">
+<div id="views-bootstrap-grid-<?php print $id ?>" class="<?php foreach($classes as $key => $value) { print $value; } ?>">
   <?php if ($options['alignment'] == 'horizontal'): ?>

     <?php foreach ($items as $row): ?>
-- 
1.7.6
klonos commented 8 years ago

@thekenshow multiline code needs to be wrapped in triple instead of single backquotes. I've done that for you πŸ˜‰

...also, you can easily create pull requests by navigating to the file you want to change in the repository (https://github.com/backdrop-contrib/views_bootstrap/blob/7.x-3.x/views-bootstrap-grid-plugin-style.tpl.php in your case) and then click the "edit" link (pencil icon between the screen and trash bin icons) available in the top-right. Follow the prompts and make sure you select the "Create a new branch for this commit and start a pull request." option - NOT the "Commit directly" option. It should be pretty straight-forward from then on πŸ˜‰

thekenshow commented 8 years ago

@klonos Thanks for cleaning this up and explaining the normal process. I have zero experience with pull requests (so pretty straightforward isn’t exactly :-) but I think I did the right thing. When I edited that file, it created a fork for me to revise There was no option to commit directly. I made the change and created a pull request at https://github.com/backdrop-contrib/views_bootstrap/pull/3.

klonos commented 8 years ago

You're welcome @thekenshow πŸ˜‰

I have zero experience with pull requests...

I didn't know that PRs were so easy to create on GitHub myself till I was introduced to the feature. I do not consider myself a coder. ...maybe an amateur one.

When I edited that file, it created a fork for me to revise There was no option to commit directly.

That's right, I see that option because I am a member of the contrib group. Wasn't sure if you were (or if someone reading my post with the instructions was), so I was just being cautious not to instruct people to do direct commits without actually being the maintainer of the project.

I made the change and created a pull request at #3.

Good start! πŸ‘ πŸŽ† I wish this is the first of many PRs for you.

Just as a note: we tent to have the PR title be in the form of Issue #x: [issue title] and also have the PR description text say "Fixes [url-to-issue]". That way, the PR gets automatically referenced in the issue and it's easier for people to see that there is a PR and also helps them to jump straight to it. Contrary to the contrib issue queue, I do not have admin rights to individual PRs, so I cannot correct these on your behalf.

klonos commented 8 years ago

...now it's up to the maintainer of the project to review the code of your PR and if they have no objections/comments, merge it to the project code.

@biolithic??

klonos commented 8 years ago

I do not have admin rights to individual PRs, so I cannot correct these on your behalf.

I actually noticed that I do have access to do that, but I won't do it unless you ask me. I'm trying to make creating proper PRs a habit for you πŸ˜„ ...let me know if you need help.

thekenshow commented 8 years ago

Thanks, I’ve renamed the PR and changed the description. Let me know if I missed anything.

https://github.com/backdrop-contrib/views_bootstrap/pull/3 https://github.com/backdrop-contrib/views_bootstrap/pull/3

β€” Cheers Ken

+1 (519) 270-5338 | http://kendow.com

All human beings should try to learn before they die what they are running from, and to, and why.

On Jul 18, 2016, at 10:17 AM, Gregory Netsas notifications@github.com wrote:

I do not have admin rights to individual PRs, so I cannot correct these on your behalf.

I actually noticed that I do have access to do that, but I won't do it unless you ask me. I'm trying to make creating proper PRs a habit for you πŸ˜„ ...let me know if you need help.

β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/backdrop-contrib/views_bootstrap/issues/1#issuecomment-233341474, or mute the thread https://github.com/notifications/unsubscribe-auth/AA89sHmTe2u90udMFvd7qZDp4OZq5jtDks5qW4rpgaJpZM4JOAmK.

klonos commented 8 years ago

...Let me know if I missed anything.

Seems just fine to me + you can now see for yourself the auto-generated reference to the PR just above your comment πŸ˜‰