Open cliffordp opened 9 years ago
Why not let me display it under the attrs?
Seems like a reasonable enhancement.
I'd dig this, too!
Could it be done w/ a 'priority' => '10',
addition to each attribute array (10 is just an ex)? Then we could have more control over the attr order in our UI.
Why not let inner_content
be a regular field and let the array order in attrs
determine the natural ordering? That way you could even (theoretically) use any field type:
array(
'label' => esc_html__( 'Content', 'shortcake' ),
'attr' => '_inner_content', // "_inner_content" is a reserved attribute name that always refers to the inner content
'type' => 'text',
'description' => esc_html__( 'Enter the content.', 'shortcake' ),
),
Why not let inner_content be a regular field and let the array order in attrs determine the natural ordering?
Because it has the potential of conflicting with an attribute named inner_content
. It's a special case.
I like the priority
idea, where every field defaults to 10
.
@danielbachhuber It would conflict with the attribute named _inner_content
, which is quite an unlikely attribute name and underscores are common convention for "private" variables. (See hidden meta fields, etc)
I think priority
just complicates what is an inherit feature in PHP arrays - natural ordering.
It would conflict with the attribute named _inner_content, which is quite an unlikely attribute name and underscores are common convention for "private" variables. (See hidden meta fields, etc)
Eh, I'm not a huge fan of special cases when we don't need to add them.
I think priority just complicates what is an inherit feature in PHP arrays - natural ordering.
priority
is an established paradigm for ordering in WordPress, particularly when adding entries after the original array has been defined (which we support through filters).
Eh, I'm not a huge fan of special cases when we don't need to add them.
But dedicating a "magic" array key like we have today for inner_content
is still be a special case, whether it's in the attrs
array or not.
It would streamline the experience for devs (all fields are handled the same), reduce code (no special handling for inner_content
required) as well as improve flexibility (use any field type for inner_content
) to stick the inner content field into attrs
array.
priority
is an established paradigm for ordering in WordPress, particularly when adding entries after the original array has been defined (which we support through filters).
Fair point, I think it's the better decision to use priority!
But dedicating a "magic" array key like we have today for inner_content is still be a special case, whether it's in the attrs array or not.
Not really. Shortcode attributes are technically different than the inner content for a shortcode.
I like the idea of getting more control over the position of 'inner_content'.
Any idea when can we expect this feature? I hope soon.
Whether
'inner_content' => array(),
is added before or after the shortcode'sattrs
, it displays first in the shortcode UI.Why not let me display it under the
attrs
?