Permalink
Browse files

Change 'allowed_grid' to 'allowed_grids' and allow it to be filtered.

  • Loading branch information...
justintadlock committed Sep 14, 2012
1 parent 6bd5eca commit 2fae04d8fedc7889b9f1197718d2d23df9bae483
Showing with 5 additions and 2 deletions.
  1. +5 −2 columns.php
View
@@ -64,7 +64,7 @@ class Columns {
* @access public
* @var array
*/
- public $allowed_grid = array( 10, 12, 16 );
+ public $allowed_grids = array( 10, 12, 16 );
/**
* Sets up our actions/filters.
@@ -130,8 +130,11 @@ public function do_shortcode( $attr, $content = null ) {
$classes = array();
$attr = shortcode_atts( array( 'grid' => 10, 'span' => 1 ), $attr );
+ /* Allow devs to overwrite the allowed grids. */
+ $this->allowed_grids = apply_filters( 'columns_allowed_grids', $this->allowed_grids );
+
/* Only allow grids 10, 12, 16. */
- $attr['grid'] = in_array( $attr['grid'], $this->allowed_grid ) ? absint( $attr['grid'] ) : 10;
+ $attr['grid'] = in_array( $attr['grid'], $this->allowed_grids ) ? absint( $attr['grid'] ) : 10;
/* Span cannot be greater than the grid. */
$attr['span'] = ( $attr['grid'] >= $attr['span'] ) ? absint( $attr['span'] ) : $attr['grid'];

0 comments on commit 2fae04d

Please sign in to comment.