All of the templates are being pulled correctly from /app/templates/Layout/Page.ss. But, the Requirements setup in the PageController init function are not being loaded in the head when I visit the results pages generated by the module.
I tried adding the template files from the module to the app/templates folder, but that didn’t resolve the problem.
I’m slightly confused now, mostly by which files are where.
Could you just lay out the structure of what you’re doing? (ie. which controllers you’re talking about, whether any of the classes are extensions, etc.)
I notice that extends Controller rather than PageController which may be the root of the issue, since your requirements calls won’t be getting seen at all.
Sorry about that. Here are the two files in question from my solution:
/app/src/PageController.php is the main page controller class for my ‘app’. This contains the init() method with the Page requirement calls that were not working on “searchable” generated pages.
/vendor/silverstripe/searchable/src/control/SearchResults.php is the controller class for the module’s search results pages. I’ve imported “SilverStripe\View\Requirements” after the module’s other class imports and repeated the same requirements calls in this class’s init() method:
use SilverStripe\i18n\i18n;
use SilverStripe\ORM\ArrayList;
use SilverStripe\View\SSViewer;
use SilverStripe\View\ArrayData;
use SilverStripe\Control\Director;
use SilverStripe\ORM\PaginatedList;
use SilverStripe\Control\Controller;
use SilverStripe\Subsites\Model\Subsite;
use ilateral\SilverStripe\Searchable\Searchable;
use SilverStripe\CMS\Controllers\ContentController;
// Added by me:
use SilverStripe\View\Requirements;
protected function init()
{
parent::init();
// Added by me:
Requirements::css($assetsFolder.'lib/foundation/css/foundation.css');
Requirements::css($assetsFolder.'lib/slick/slick.css');
//etc
}