PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-beta
Jetpack – WP Security, Backup, Speed, & Growth v16.3-beta
16.3-beta 16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 All 507 releases
← All changes | jetpack_vendor/automattic/jetpack-premium-analytics/src/class-dashboard-section.php +18 -8 16.2 → 16.3-beta View file →
@@ -169,15 +169,8 @@
169 169 *
170 170 * @return bool
171 171 */
172 172 public function is_available() {
173 - // The preview scope is about the rollout rather than the site, so it sits ahead of the
174 - // section's own check. The default-layout route answers the same question separately,
175 - // because it runs before the registry is populated.
176 - if ( ! is_dashboard_section_in_preview_scope( $this->dashboard_name, $this->slug ) ) {
177 - return false;
178 - }
179 -
180 173 if ( is_callable( $this->is_available ) ) {
181 174 return (bool) call_user_func( $this->is_available, $this );
182 175 }
183 176
@@ -184,9 +177,9 @@
184 177 return (bool) $this->is_available;
185 178 }
186 179
187 180 /**
188 - * Returns the section's default widget layout.
181 + * Returns the section's default widget layout, run through the default-layout filter.
189 182 *
190 183 * @return array Array of widget instances.
191 184 */
192 185 public function get_default_layout() {
@@ -192,8 +185,25 @@
192 185 public function get_default_layout() {
193 186 $layout = is_callable( $this->default_layout )
194 187 ? call_user_func( $this->default_layout, $this )
195 188 : $this->default_layout;
189 + $layout = is_array( $layout ) ? array_values( $layout ) : array();
190 +
191 + /**
192 + * Filters a dashboard section's default widget layout.
193 + *
194 + * Each entry matches the dashboard's widget instance shape: `uuid`, `type`, optional
195 + * `attributes`, optional `placement`. Runs for every section, so a callback adding an
196 + * instance to one switches on `$section_id`.
197 + *
198 + * @since 0.8.0 Runs from the section, with its declared layout and its
199 + * namespaced id; it received an empty array and any alias before.
200 + *
201 + * @param array $layout The section's declared default widget instances.
202 + * @param string $section_id Namespaced section identifier, e.g. `analytics/traffic`.
203 + * @param Dashboard_Section $section The section.
204 + */
205 + $layout = apply_filters( DASHBOARD_DEFAULT_LAYOUT_FILTER, $layout, $this->id, $this );
196 206
197 207 return is_array( $layout ) ? array_values( $layout ) : array();
198 208 }
199 209