unclecheese / silverstripe-gridfield-betterbuttons

Adds new form actions and buttons to the GridField detail form

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

javascripts/css links no longar valid in SilverStripe 4.1

Martimiz opened this issue · comments

SilverStripe 4.1 seems to want javascript/css to live in resources/betterbuttons (fysically public/resources/betterbuttons), unless the path is set from the site root,

so this seems to fix that:
_config.php
use \SilverStripe\Control\Director;
define('BETTER_BUTTONS_DIR', Director::baseURL() . basename(dirname(FILE)));

[EDIT] Sorry: This doesn't fix anything: it strips 'resources' from the url, but that will still generate a 404 (.htacces redirecting everything) :(

Martine

For now, in my dev setup, I did a quick and dirty .htaccess fix like this:

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/betterbuttons/javascript.*
RewriteCond %{REQUEST_URI} !^/betterbuttons/css.*
RewriteCond %{REQUEST_URI} !^/betterbuttons/images.*
RewriteRule ^(.*)$ public/$1

that plus _config.php

use \SilverStripe\Control\Director;
define('BETTER_BUTTONS_DIR', Director::absoluteBaseURL()  . basename(dirname(__FILE__)));

... got it working again, but obviously modules in the root are not the thing anymore? What would be the best course? Besides better buttons finally becoming part of core :)

Martine

that somehow did't work for me, so i just added a symlink in the /public/ folder:
ln -s ../betterbuttons betterbuttons

Yes, you’re right, I ultimately wound up with css/javascript/images in public too - but your symlink is a far nicer workaround for now 😊