[wp-trac] [WordPress Trac] #22924: Add filter to theme editor accepted files
WordPress Trac
noreply at wordpress.org
Tue Oct 13 18:29:17 UTC 2015
#22924: Add filter to theme editor accepted files
-------------------------+-----------------------------
Reporter: pross | Owner: wonderboymusic
Type: enhancement | Status: reopened
Priority: normal | Milestone: 4.4
Component: Themes | Version: 3.5
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
-------------------------+-----------------------------
Changes (by DrewAPicture):
* status: closed => reopened
* resolution: fixed =>
Comment:
Is the intention of the new `wp_theme_editor_filetypes` filter to make it
possible to bring in ''arbitrary files'' or to expand the filetypes? Seems
like based on the name alone we might be better off doing an array of file
types then looping with `$theme->get_files()` on those types, e.g.
(pseudo)
{{{#!php
<?php
/**
* Filter the list of files allowed for editing in the Theme editor.
*
* @since 4.4.0
*
* @param array $file_types List of file types.
* @param object $theme The current Theme object.
*/
$file_types = apply_filters( 'wp_theme_editor_filetypes', array( 'php',
'css' ), $theme );
foreach ( $file_types as $type ) {
$allowed_files + $theme->get_files( $type );
}
...
if ( $allowed_files ) :
if ( $theme->get_files( 'php' ) || $theme->parent() ) :
?>
}}}
The hook description also needs a little work, it's super vague.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/22924#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list