This module adds a new style plugin to views. It allows content to be displayed into a configurable numbers of columns. The items in the columns can be arranged horizontally (left to right) or vertically (top to bottom).
The columns are generated in the template layer as floating div's. Some basic styling is included for the columns.

So why is this usefull?

  • Grid layout's don't work well with items of different height, columns do.
  • Browser support for CSS3 columns is still lacking.

Similar modules

I've looked at / tested simular modules, but these all seem to use a javascript library, and don't offer the same simple layout and template options.
http://drupal.org/project/views_isotope
http://drupal.org/project/views_fluidgrid
http://drupal.org/project/views_fluid_grid

It is not a very complicated module, but I've have found many uses for it, and would like to share it with other Drupal users.

Code

Project page: http://drupal.org/sandbox/K3vin/2005410
GIT: git clone http://git.drupal.org/sandbox/K3vin/2005410.git views_columns

CommentFileSizeAuthor
Porsche 911 SC.png559.46 KBk3vin_nl

Comments

thamba’s picture

Hi K3vin,

An automated review of your module returned the following:

Review of the 7.x-1.x branch:

README.txt is missing, see the guidelines for in-project documentation.
Coder Sniffer has found some issues with your code (please check the Drupal coding standards). See attachment.
This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.


FILE: /var/www/drupal-7-pareview/pareview_temp/views-columns.tpl.php
--------------------------------------------------------------------------------
FOUND 14 ERROR(S) AFFECTING 10 LINE(S)
--------------------------------------------------------------------------------
3 | ERROR | The second line in the file doc comment must be " * @file"
19 | ERROR | Expected 1 space after "="; 2 found
23 | ERROR | The control statement should use the ":" alternative syntax
| | instead of curly braces in template files
24 | ERROR | The control statement should use the ":" alternative syntax
| | instead of curly braces in template files
26 | ERROR | Expected 1 space before "="; 0 found
26 | ERROR | Expected 1 space after "="; 0 found
31 | ERROR | The control statement should use the ":" alternative syntax
| | instead of curly braces in template files
43 | ERROR | Expected 1 space before "="; 0 found
43 | ERROR | Expected 1 space after "="; 0 found
44 | ERROR | The control statement should use the ":" alternative syntax
| | instead of curly braces in template files
47 | ERROR | The control statement should use the ":" alternative syntax
| | instead of curly braces in template files
47 | ERROR | Expected 1 space before "+"; 0 found
47 | ERROR | Expected 1 space after "+"; 0 found
50 | ERROR | Concat operator must be surrounded by spaces
--------------------------------------------------------------------------------

FILE: /var/www/drupal-7-pareview/pareview_temp/views_columns.info
--------------------------------------------------------------------------------
FOUND 2 ERROR(S) AFFECTING 2 LINE(S)
--------------------------------------------------------------------------------
7 | ERROR | It's only necessary to declare files[] if they declare a class or
| | interface.
8 | ERROR | It's only necessary to declare files[] if they declare a class or
| | interface.
--------------------------------------------------------------------------------

FILE: /var/www/drupal-7-pareview/pareview_temp/views_columns.module
--------------------------------------------------------------------------------
FOUND 3 ERROR(S) AND 1 WARNING(S) AFFECTING 4 LINE(S)
--------------------------------------------------------------------------------
3 | ERROR | The second line in the file doc comment must be " * @file"
8 | WARNING | Format should be "* Implements hook_foo().", "* Implements
| | hook_foo_BAR_ID_bar() for xyz_bar().", or "* Implements
| | hook_foo_BAR_ID_bar() for xyz_bar.tpl.php.".
17 | ERROR | Function comment short description must end with a full stop
24 | ERROR | Inline comments must end in full-stops, exclamation marks, or
| | question marks
--------------------------------------------------------------------------------

FILE: /var/www/drupal-7-pareview/pareview_temp/views_columns.views.inc
--------------------------------------------------------------------------------
FOUND 2 ERROR(S) AND 2 WARNING(S) AFFECTING 4 LINE(S)
--------------------------------------------------------------------------------
3 | ERROR | The second line in the file doc comment must be " * @file"
4 | WARNING | Line exceeds 80 characters; contains 85 characters
8 | WARNING | Format should be "* Implements hook_foo().", "* Implements
| | hook_foo_BAR_ID_bar() for xyz_bar().", or "* Implements
| | hook_foo_BAR_ID_bar() for xyz_bar.tpl.php.".
17 | ERROR | No space before comment text; expected "// 'parent' =>
| | 'table'," but found "//'parent' => 'table',"
--------------------------------------------------------------------------------

FILE: .../drupal-7-pareview/pareview_temp/views_columns_plugin_style_columns.inc
--------------------------------------------------------------------------------
FOUND 14 ERROR(S) AFFECTING 4 LINE(S)
--------------------------------------------------------------------------------
12 | ERROR | Class name must begin with a capital letter
12 | ERROR | Class name must use UpperCamel naming without underscores
13 | ERROR | Missing function doc comment
13 | ERROR | Method name
| | "views_columns_plugin_style_columns::option_definition" is not in
| | lowerCamel format, it must not contain underscores
13 | ERROR | No scope modifier specified for function "option_definition"
23 | ERROR | Method name "views_columns_plugin_style_columns::options_form" is
| | not in lowerCamel format, it must not contain underscores
23 | ERROR | No scope modifier specified for function "options_form"
33 | ERROR | Constants must be uppercase; expected VERTICAL but found vertical
33 | ERROR | Expected 1 space between "vertical" and double arrow; 0 found
33 | ERROR | Expected 1 space between double arrow and "'vertical'"; 0 found
33 | ERROR | Expected 1 space before "=>"; 0 found
33 | ERROR | Expected 1 space after "=>"; 0 found
33 | ERROR | Constants must be uppercase; expected HORIZONTAL but found
| | horizontal
33 | ERROR | There should be no white space before a closing ")"
--------------------------------------------------------------------------------

I did a manual review of your module and found the following that can be fixed:

  • You still have a master branch in your project. You need to set the default branch to your 7.x-1.x branch and delete your master branch. Read this: Setting a default branch.
  • Your git clone URL is wrong. Please change it to:
    git clone http://git.drupal.org/sandbox/K3vin/2005410.git views_columns
  • Its useful to add a README.txt file in your module that describes how to install and configure your module.
  • I get the following errors when configuring the columns in views:
    Notice: Use of undefined constant vertical - assumed 'vertical' in views_columns_plugin_style_columns->options_form() (line 33 of /var/www/drupal/sites/all/modules/contrib/views_columns/views_columns_plugin_style_columns.inc).
    Notice: Use of undefined constant horizontal - assumed 'horizontal' in views_columns_plugin_style_columns->options_form() (line 33 of /var/www/drupal/sites/all/modules/contrib/views_columns/views_columns_plugin_style_columns.inc).
    
k3vin_nl’s picture

Thanks for noticing my typo in the git link! I've created the correct branch and removed the master branch.

I have added a README.txt to the module, fixed the code style issues (where possible: I don't think it is possible to fix the view method name errors) and fixed the PHP notice.

PA robot’s picture

Status: Needs review » Needs work

There are some errors reported by automated review tools, did you already check them? See http://ventral.org/pareview/httpgitdrupalorgsandboxK3vin2005410git

I'm a robot and this is an automated message from Project Applications Scraper.

k3vin_nl’s picture

Status: Needs work » Needs review

Fixed all of the code style issues, except:

  • ViewsColumnsPluginStyleColumns::options_form
  • ViewsColumnsPluginStyleColumns::option_definition

I also cleaned up the template file by moving the generation of classes to the preprocess function.

k3vin_nl’s picture

Status: Needs review » Needs work

Found a bug in the vertical display option.

k3vin_nl’s picture

Status: Needs work » Needs review

Fixed the array structure needed for vertical option.

_timpatrick’s picture

Hi K3vin,

No errors were found with the automated coder review.
In addition, I manually tested the project:

Overall - works as expected. No errors when setting or configuring the columns in views, and tested using multiple content types and column layouts. Looking at the code, everything appears to be fine.
The branch has been changed to 7.x-1.x, README.txt file exists, and the git link changed as suggested by thamba.

_timpatrick’s picture

Status: Needs review » Reviewed & tested by the community
kscheirer’s picture

Status: Reviewed & tested by the community » Needs work

You have a typo in your readme, "coluns" should be "columns". Can you explain a little more how this differs from the Grid layout - shouldn't that be able to achieve the same effect?

Using hook_init()
You seem to be using hook_init() to load libraries, js, css, or includes. These will be loaded on every Drupal page request, and they should be moved to only load where they are actually needed.

----
Top Shelf Modules - Crafted, Curated, Contributed.

PA robot’s picture

Status: Needs work » Closed (won't fix)

Closing due to lack of activity. Feel free to reopen if you are still working on this application (see also the project application workflow).

I'm a robot and this is an automated message from Project Applications Scraper.

PA robot’s picture

Issue summary: View changes

Corrected link to git repo.