Skip to content

Commit fac0bcc

Browse files
author
joelworsham
committed
Allow args in post_list template. Build
1 parent 3149ed8 commit fac0bcc

5 files changed

Lines changed: 19 additions & 10 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Simply download the master zip (the button on the right that says "Download ZIP"
6363
* UPDATE: Force require at least PHP 5.3.
6464
* DEVELOPERS: Improve shortcode attribute template functionality, especially the post list template.
6565

66-
### [1.0.2](https://github.com/brashrebel/render/releases/tag/v1.0.2)
66+
### [1.1-beta-2](https://github.com/brashrebel/render/releases/tag/v1.0.2)
6767
* FIX: Content in shortcodes disappearing when adding one shortcode into the entire content of another.
6868
* FIX: Potential PHP notice of defining a licensing constant.
6969
* UPDATE: Improved TinyMCE shortcode tooltip usability.

build/core/functions.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -463,18 +463,16 @@ function render_sc_attr_template( $template, $extra = array(), $args = array() )
463463

464464
case 'link':
465465

466-
// 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
467-
468466
$output = array(
469467
'label' => __( 'Link', 'Render' ),
470468
'description' => __( 'Links to a post / page.', 'Render' ),
471469
'type' => 'selectbox',
472470
'properties' => array(
473471
'placeholder' => __( 'Select a post / page, or type a link', 'Render' ),
474472
'allowCustomInput' => true,
475-
'groups' => array(),
476473
'callback' => array(
477474
'function' => 'render_sc_post_list',
475+
'args' => $args,
478476
),
479477
),
480478
);

build/core/modal.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -535,8 +535,20 @@ private static function att_type_selectbox( $att_id, $att, $properties = array()
535535

536536
if ( ! empty( $options ) ) {
537537

538-
// We need to merge our arrays, but we need to do it with either groups or options (whichever is in use)
539-
$which = ! empty( $properties['groups'] ) ? 'groups' : 'options';
538+
// Figure out if groups or not
539+
$which = 'options';
540+
foreach ( $options as $option_value ) {
541+
if ( is_array( $option_value ) ) {
542+
$which = 'groups';
543+
break;
544+
}
545+
}
546+
547+
// Icons are different
548+
if ( $properties['allowIcons'] ) {
549+
$which = 'options';
550+
}
551+
540552
if ( ! empty( $properties[ $which ] ) ) {
541553
$properties[ $which ] = array_merge( $options, $properties[ $which ] );
542554
} else {

build/core/shortcodes/core/query.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@
8484
'label' => __( 'Include', 'Render' ),
8585
'properties' => array(
8686
'multi' => true,
87+
'placeholder' => 'Select an option',
8788
),
8889
'conditional' => array(
8990
'populate' => array(
@@ -98,6 +99,7 @@
9899
'label' => __( 'Exclude', 'Render' ),
99100
'properties' => array(
100101
'multi' => true,
102+
'placeholder' => 'Select an option',
101103
),
102104
'conditional' => array(
103105
'populate' => array(

src/core/functions.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -463,19 +463,16 @@ function render_sc_attr_template( $template, $extra = array(), $args = array() )
463463

464464
case 'link':
465465

466-
// 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
467-
468466
$output = array(
469467
'label' => __( 'Link', 'Render' ),
470468
'description' => __( 'Links to a post / page.', 'Render' ),
471469
'type' => 'selectbox',
472470
'properties' => array(
473471
'placeholder' => __( 'Select a post / page, or type a link', 'Render' ),
474472
'allowCustomInput' => true,
475-
'groups' => array(),
476473
'callback' => array(
477-
'groups' => true,
478474
'function' => 'render_sc_post_list',
475+
'args' => $args,
479476
),
480477
),
481478
);

0 commit comments

Comments
 (0)