I didn't found a link to create an account in Trac so I post here...
=====================
Hi all,
when I tried to create a theme to customise the uploader interface, I
found that it was not possible to override the files in core/views/.
It's a problem for a good themability.
Currently G3 looks for views in :
- core/views/
- theme/<active theme>/views/
- module/<module>/views/
The first file found is selected. The first directory can't be changed,
it will always be core/views/.
The patch override_core_views.patch change this directories list to :
- core/views/
- theme/<active theme>/views/
- theme/<default theme>/views/
- module/<module>/views/
Depending where you are <default theme> is "default" or "admin_default".
If you apply this patch you could move :
- core/views/admin_* to theme/admin_default/views/
- core/views/* to theme/default/views/
(except form.html.php, this view seems to be a special case)
After the views have been moved, it's easy to customise all parts of G3.
Just create a file theme/mytheme/views/simple_uploader.html.php and it
will override the default uploader. If you don't create one in your
custom theme, it will automatically choose
theme/default/views/simple_uploader.html.php
------------
My goal was just to create a custom uploader so it was not necessary to
have a copy of css/, js/ and image/.
When, in a view, you call $theme->url('myfile'), the method only returns
the URL /theme/<active theme>/myfile
With the second patch (default_theme_content.patch), the method returns
the same URL except if the file doesn't exist AND the same file in the
<default theme> exists.
I'm not sure the second patch is a good idea, there is pro (themes that
use theses scripts will stay up to date) and con could create some
confusion), but I think the first one fixes a serious issue.
Greetings.
[default_theme_content.patch]
Index: core/libraries/Theme_View.php
===================================================================
--- core/libraries/Theme_View.php (révision 20900)
+++ core/libraries/Theme_View.php (copie de travail)
@@ -68,7 +68,17 @@
}
public function url($path, $absolute_url=false) {
- $arg = "themes/{$this->theme_name}/$path";
+ $default_theme = (Router::$controller == "admin")
+ ? "admin_default"
+ : "default";
+
+ if (!file_exists(THEMEPATH . "{$this->theme_name}/$path")
+ && file_exists(THEMEPATH . "$default_theme/$path")) {
+ $arg = "themes/$default_theme/$path";
+ } else {
+ $arg = "themes/{$this->theme_name}/$path";
+ }
+
return $absolute_url ? url::abs_file($arg) : url::file($arg);
}
[override_core_views.patch]
Index: core/helpers/theme.php
===================================================================
--- core/helpers/theme.php (révision 20900)
+++ core/helpers/theme.php (copie de travail)
@@ -31,8 +31,10 @@
static function load_themes() {
$modules = Kohana::config("core.modules");
if (Router::$controller == "admin") {
+ array_unshift($modules, THEMEPATH . "admin_default");
array_unshift($modules, THEMEPATH . module::get_var("core", "active_admin_theme"));
} else {
+ array_unshift($modules, THEMEPATH . "default");
array_unshift($modules, THEMEPATH . module::get_var("core", "active_site_theme"));
}
Kohana::config_set("core.modules", $modules);
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship.
http://www.creativitycat.com __[ g a l l e r y - d e v e l ]_________________________
[ list info/archive -->
http://gallery.sf.net/lists.php ]
[ gallery info/FAQ/download -->
http://gallery.sf.net ]