equal
deleted
inserted
replaced
10 /** |
10 /** |
11 * Core class that implements a gallery widget. |
11 * Core class that implements a gallery widget. |
12 * |
12 * |
13 * @since 4.9.0 |
13 * @since 4.9.0 |
14 * |
14 * |
|
15 * @see WP_Widget_Media |
15 * @see WP_Widget |
16 * @see WP_Widget |
16 */ |
17 */ |
17 class WP_Widget_Media_Gallery extends WP_Widget_Media { |
18 class WP_Widget_Media_Gallery extends WP_Widget_Media { |
18 |
19 |
19 /** |
20 /** |
48 * @since 4.9.0 |
49 * @since 4.9.0 |
49 * |
50 * |
50 * @see WP_REST_Controller::get_item_schema() |
51 * @see WP_REST_Controller::get_item_schema() |
51 * @see WP_REST_Controller::get_additional_fields() |
52 * @see WP_REST_Controller::get_additional_fields() |
52 * @link https://core.trac.wordpress.org/ticket/35574 |
53 * @link https://core.trac.wordpress.org/ticket/35574 |
|
54 * |
53 * @return array Schema for properties. |
55 * @return array Schema for properties. |
54 */ |
56 */ |
55 public function get_instance_schema() { |
57 public function get_instance_schema() { |
56 $schema = array( |
58 $schema = array( |
57 'title' => array( |
59 'title' => array( |
105 * Render the media on the frontend. |
107 * Render the media on the frontend. |
106 * |
108 * |
107 * @since 4.9.0 |
109 * @since 4.9.0 |
108 * |
110 * |
109 * @param array $instance Widget instance props. |
111 * @param array $instance Widget instance props. |
110 * @return void |
|
111 */ |
112 */ |
112 public function render_media( $instance ) { |
113 public function render_media( $instance ) { |
113 $instance = array_merge( wp_list_pluck( $this->get_instance_schema(), 'default' ), $instance ); |
114 $instance = array_merge( wp_list_pluck( $this->get_instance_schema(), 'default' ), $instance ); |
114 |
115 |
115 $shortcode_atts = array_merge( |
116 $shortcode_atts = array_merge( |
197 <# if ( ! attachment.alt && attachment.filename ) { #> |
198 <# if ( ! attachment.alt && attachment.filename ) { #> |
198 aria-label=" |
199 aria-label=" |
199 <?php |
200 <?php |
200 echo esc_attr( |
201 echo esc_attr( |
201 sprintf( |
202 sprintf( |
202 /* translators: %s: the image file name. */ |
203 /* translators: %s: The image file name. */ |
203 __( 'The current image has no alternative text. The file name is: %s' ), |
204 __( 'The current image has no alternative text. The file name is: %s' ), |
204 '{{ attachment.filename }}' |
205 '{{ attachment.filename }}' |
205 ) |
206 ) |
206 ); |
207 ); |
207 ?> |
208 ?> |
211 <# if ( index === 5 && data.ids.length > 6 ) { #> |
212 <# if ( index === 5 && data.ids.length > 6 ) { #> |
212 <div class="gallery-icon-placeholder"> |
213 <div class="gallery-icon-placeholder"> |
213 <p class="gallery-icon-placeholder-text" aria-label=" |
214 <p class="gallery-icon-placeholder-text" aria-label=" |
214 <?php |
215 <?php |
215 printf( |
216 printf( |
216 /* translators: %s: the amount of additional, not visible images in the gallery widget preview. */ |
217 /* translators: %s: The amount of additional, not visible images in the gallery widget preview. */ |
217 __( 'Additional images added to this gallery: %s' ), |
218 __( 'Additional images added to this gallery: %s' ), |
218 '{{ data.ids.length - 5 }}' |
219 '{{ data.ids.length - 5 }}' |
219 ); |
220 ); |
220 ?> |
221 ?> |
221 ">+{{ data.ids.length - 5 }}</p> |
222 ">+{{ data.ids.length - 5 }}</p> |