Jump to content

Recommended Posts

Posted
2 hours ago, Martijn Geerts said:

@PWaddict, do you use the dependencies or the default injection method?

I tried both. The default one injects a broken link as I described above and the dependencies doesn't inject anything.

Posted
1 hour ago, bernhard said:

i think it's more related to setting up a proper rewrite base than changing this module.

https://processwire.com/docs/tutorials/troubleshooting-guide/page3

I'm not sure cause every other link on ProcessWire works great except the link injection in this module. 

On the AdminCustomFiles.module I replaced the 249 line:

'relative' => substr($base, strpos($base, '/site/templates/')),

to this and it worked:

'relative' => substr($base, strpos($base, '/mysite.com/site/templates/')),

It seems that the module can't recognize that ProccessWire installed on localhost/mysite.com.

  • Like 1
  • 2 months later...
Posted

Hi, 

I only see the changes of my css file (templates/AdminCustomFiles/AdminThemeReno.css) when I'm logged-in as superuser, when I have an other roll I just see the default AdminThemeReno. Does anyone know what I'm doing wrong?

*working with version: 3.0.59

Posted

 for some reason the 'include theme based files' stopped working, so i added AdminCustomFiles/AdminThemeReno.css to the dependencies, and it works.. @Peejay that might solve your problem...

  • Like 1
Posted

@Peejay there are some more little improvements coming up but there are still a few annoyances. But there will be updates soon, sorry guys for the delays, but free time is sparse these days.

 

  • Like 3
  • 1 month later...
Posted

Hi @Martijn Geerts, just a heads up that the current version number of this module is 0.0.1 - is that supposed to be 1.0.0?

Because I've just noticed that the version I have been running is 0.8.7 which is older than the current version yet I never get an upgrade prompt in the Upgrades module due to the low current version number.

Also, did you change GitHub repos at some point? There seems to be only a few months of commit history yet the module has been around much longer than that.

  • 4 months later...
Posted

I'm trying to inject a custom js for AdminThemeUikit but it loads before the original AdminThemeUikit js files. How to make it load after the original files?

AdminThemeUikitJS.thumb.jpg.d2340e4b691b7b70c047edc56d3fd5a4.jpg 

Posted
1 hour ago, Martijn Geerts said:

@PWaddict

I think i'm locked in... don't know how to solve this one.

$config->scripts and $config->styles are echoed before those  admin scripts are echoed. I don't know what I can do about that.

 

 

Here is the css & js structure with the AdminThemeDefault:

AdminThemeDefault.thumb.jpg.6cd90dc94f6e63fa3f0f8eae986d6a35.jpg

and here is with the AdminThemeUikit:

AdminThemeUikit.thumb.jpg.8b97c2fb0eeec0964f4cbf28e1b7fca1.jpg

So maybe it needs an extra hook that is specific to AdminThemeUikit in order for the files to be injected at the very end???

Posted
On 10/28/2017 at 8:54 AM, PWaddict said:

I'm trying to inject a custom js for AdminThemeUikit but it loads before the original AdminThemeUikit js files. How to make it load after the original files?

AdminThemeUikitJS.thumb.jpg.d2340e4b691b7b70c047edc56d3fd5a4.jpg 

Maybe I'm looking at this wrong, but you should physically list the AdminThemeUikitCustom.js after all the uikit js in whatever template file you are using.

Posted

You can also inject scripts and styles by hooking the page render and doing a str_replace("</head>", $yourscripts . "</head>", $event->return)

  • Like 4
Posted
48 minutes ago, bernhard said:

You can also inject scripts and styles by hooking the page render and doing a str_replace("</head>", $yourscripts . "</head>", $event->return)

Is it possible to do this on site/ready.php without creating a module?

Posted

Sure, just hook page render and modify event->return like I showed above. I'm on mobile but this info is easy to find in the forum, it's nothing special

Posted

@bernhard Here is the code I used on site/ready.php and it works great:

if($this->page->template == 'admin') {
$this->addHookAfter('Page::render', function($event) {
	$css = wire('config')->urls->templates . 'styles/AdminThemeUikit.css?v=1';
	$js = wire('config')->urls->templates . 'scripts/AdminThemeUikit.js?v=1';
	$event->return = str_replace("</head>", "\n<link type='text/css' href='{$css}' rel='stylesheet'/>\n</head>", $event->return);
	$event->return = str_replace("</body>", "\n<script type='text/javascript' src='{$js}'></script>\n</body>", $event->return);
});
};

I've also uninstalled Admin Custom Files since I was only using it to inject theme files. Thank you.

  • Like 4
Posted

Another option for adding elements at the end of <head>:

$wire->addHookAfter('AdminTheme::getExtraMarkup', function(HookEvent $event) {
    $parts = $event->return;
    $parts['head'] .= "<script src='/path/to/script.js'></script>";
    $event->return = $parts;
});

 

  • Like 5
Posted

@Martijn Geerts 

I upgraded from 0.8.7 to 0.9.4 and I get:

Warning: Invalid argument supplied for foreach() in C:\inetpub\wwwroot\site\modules\AdminCustomFiles\AdminCustomFiles.module on line 249
$files = NULL
$dependencies = string(41) "ProcessPageEdit AdminCustomFiles/test.css"

Also, AdminCustomFiles.js fails at line 19.

I see that you dropped support for PW 2. Any reason for that?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...