| @@ -180,17 +180,39 @@ | ||
| 180 | 180 | |
| 181 | 181 | /** |
| 182 | 182 | * Flat list of every capability slug. |
| 183 | 183 | * |
| 184 | + * Deliberately does NOT walk catalogue(): that one calls __() on every | |
| 185 | + * label, and the capability bridge fires on `user_has_cap` which can run | |
| 186 | + * before the `init` action. Translating that early triggers WordPress 6.7's | |
| 187 | + * `_load_textdomain_just_in_time was called incorrectly` warning. Slugs are | |
| 188 | + * identifiers, not UI copy — they live here, labels live in catalogue(). | |
| 189 | + * | |
| 184 | 190 | * @return string[] |
| 185 | 191 | */ |
| 186 | 192 | public static function all_slugs() { |
| 187 | 193 | static $slugs = null; |
| 188 | 194 | if ( null === $slugs ) { |
| 189 | - $slugs = []; | |
| 190 | - foreach ( self::catalogue() as $group ) { | |
| 191 | - $slugs = array_merge( $slugs, array_keys( $group['permissions'] ) ); | |
| 192 | - } | |
| 195 | + $slugs = apply_filters( 'ablocks/permissions/slugs', [ | |
| 196 | + // editing | |
| 197 | + 'ablocks_use_editor', | |
| 198 | + 'ablocks_edit_style', | |
| 199 | + 'ablocks_edit_advanced', | |
| 200 | + 'ablocks_edit_custom_css', | |
| 201 | + 'ablocks_copy_paste_style', | |
| 202 | + // design | |
| 203 | + 'ablocks_manage_global_styles', | |
| 204 | + 'ablocks_manage_theme_builder', | |
| 205 | + 'ablocks_access_site_editor', | |
| 206 | + 'ablocks_import_templates', | |
| 207 | + // admin screens | |
| 208 | + 'ablocks_manage_settings', | |
| 209 | + 'ablocks_manage_performance', | |
| 210 | + 'ablocks_manage_forms', | |
| 211 | + 'ablocks_view_submissions', | |
| 212 | + 'ablocks_run_scanner', | |
| 213 | + 'ablocks_manage_addons', | |
| 214 | + ] ); | |
| 193 | 215 | } |
| 194 | 216 | return $slugs; |
| 195 | 217 | } |
| 196 | 218 | |