[wp-trac] [WordPress Trac] #28693: Make gallery defaults configurable

WordPress Trac noreply at wordpress.org
Thu Jul 17 23:13:12 UTC 2014


#28693: Make gallery defaults configurable
-------------------------------------+-----------------------------
 Reporter:  michal429                |       Owner:  wonderboymusic
     Type:  enhancement              |      Status:  reopened
 Priority:  normal                   |   Milestone:  4.0
Component:  Gallery                  |     Version:  trunk
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |     Focuses:  javascript
-------------------------------------+-----------------------------
Changes (by GregLone):

 * keywords:  has-patch => has-patch needs-testing
 * status:  closed => reopened
 * resolution:  fixed =>


Comment:

 Hi.

 It seems it doesn't work properly. Here what I've done:
 {{{
 add_filter( 'media_view_settings', 'sfgv_localize_gallery_defaults', 10, 2
 );

 function sfgv_localize_gallery_defaults( $settings, $post ) {
         $defaults = ! empty( $settings['galleryDefaults'] ) && is_array(
 $settings['galleryDefaults'] ) ? $settings['galleryDefaults'] : array();
         $settings['galleryDefaults'] = array_merge( $defaults, array(
                 'itemtag'       => 'figure',
                 'icontag'       => 'div',
                 'captiontag'    => 'figcaption',
                 'columns'       => 5,
                 'size'          => 'gallery-thumb',
                 'link'          => 'file',
         ) );
         return $settings;
 }
 }}}

 Results:

 The custom values are added to the `_wpMediaViewsL10n` JS var, good.

 In the gallery creation window:
 - The default columns value is 3,
 - The default link value is post.
 In short, none of my custom values are applied.

 I keep the default values as it and send the gallery to the editor:
 - I have 5 columns,
 - The tags are dl/dt/dd,
 - The image size is still thumbnail.
 In short, only the number of columns is applied.

 I click the gallery, then the edit button:
 - Still 3 columns and "post".

 One more thing.
 If html5 support is set for the gallery shortcode, the tags used are
 figure/div/figcaption instead of dl/dt/dd. Perhaps should we do the same
 things in the editor? But it may not be really useful though.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/28693#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list