Skip to content

Commit

Permalink
Allow args in post_list template. Build
Browse files Browse the repository at this point in the history
  • Loading branch information
joelworsham committed Feb 28, 2015
1 parent 3149ed8 commit fac0bcc
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Simply download the master zip (the button on the right that says "Download ZIP"
* UPDATE: Force require at least PHP 5.3.
* DEVELOPERS: Improve shortcode attribute template functionality, especially the post list template.

### [1.0.2](https://github.com/brashrebel/render/releases/tag/v1.0.2)
### [1.1-beta-2](https://github.com/brashrebel/render/releases/tag/v1.0.2)
* FIX: Content in shortcodes disappearing when adding one shortcode into the entire content of another.
* FIX: Potential PHP notice of defining a licensing constant.
* UPDATE: Improved TinyMCE shortcode tooltip usability.
Expand Down
4 changes: 1 addition & 3 deletions build/core/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -463,18 +463,16 @@ function render_sc_attr_template( $template, $extra = array(), $args = array() )

case 'link':

// FIXME Allow args to be passed through to render_sc_post_list which allows choosing what's used as the value and name in the options list

$output = array(
'label' => __( 'Link', 'Render' ),
'description' => __( 'Links to a post / page.', 'Render' ),
'type' => 'selectbox',
'properties' => array(
'placeholder' => __( 'Select a post / page, or type a link', 'Render' ),
'allowCustomInput' => true,
'groups' => array(),
'callback' => array(
'function' => 'render_sc_post_list',
'args' => $args,
),
),
);
Expand Down
16 changes: 14 additions & 2 deletions build/core/modal.php
Original file line number Diff line number Diff line change
Expand Up @@ -535,8 +535,20 @@ private static function att_type_selectbox( $att_id, $att, $properties = array()

if ( ! empty( $options ) ) {

// We need to merge our arrays, but we need to do it with either groups or options (whichever is in use)
$which = ! empty( $properties['groups'] ) ? 'groups' : 'options';
// Figure out if groups or not
$which = 'options';
foreach ( $options as $option_value ) {
if ( is_array( $option_value ) ) {
$which = 'groups';
break;
}
}

// Icons are different
if ( $properties['allowIcons'] ) {
$which = 'options';
}

if ( ! empty( $properties[ $which ] ) ) {
$properties[ $which ] = array_merge( $options, $properties[ $which ] );
} else {
Expand Down
2 changes: 2 additions & 0 deletions build/core/shortcodes/core/query.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
'label' => __( 'Include', 'Render' ),
'properties' => array(
'multi' => true,
'placeholder' => 'Select an option',
),
'conditional' => array(
'populate' => array(
Expand All @@ -98,6 +99,7 @@
'label' => __( 'Exclude', 'Render' ),
'properties' => array(
'multi' => true,
'placeholder' => 'Select an option',
),
'conditional' => array(
'populate' => array(
Expand Down
5 changes: 1 addition & 4 deletions src/core/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -463,19 +463,16 @@ function render_sc_attr_template( $template, $extra = array(), $args = array() )

case 'link':

// FIXME Allow args to be passed through to render_sc_post_list which allows choosing what's used as the value and name in the options list

$output = array(
'label' => __( 'Link', 'Render' ),
'description' => __( 'Links to a post / page.', 'Render' ),
'type' => 'selectbox',
'properties' => array(
'placeholder' => __( 'Select a post / page, or type a link', 'Render' ),
'allowCustomInput' => true,
'groups' => array(),
'callback' => array(
'groups' => true,
'function' => 'render_sc_post_list',
'args' => $args,
),
),
);
Expand Down

0 comments on commit fac0bcc

Please sign in to comment.