1

I'm trying to load a component custom css file, placed in the frontend media folder in the media/mycomponent/css folder, to load into the backend after the backend template.css file (Isis) is loaded (in the head tag of every page). Is this possible? I've tried some options but so far no success.

2
  • Expand your answer to show what you have tried.
    – RichardB
    Commented May 10, 2017 at 14:50
  • Please include your comment content also in question so everyone will see what exactly you want to archive. Commented May 13, 2017 at 20:19

2 Answers 2

1

In the view of your component just add the CSS declaration as you normally would on the front end. Should work with no issues.

JFactory::getDocument()->addStyleSheet(JPATH_SITE . '/media/mycomponent/css/STYLE.css');

This should pull from the front end. You may be able to substitue JPATH_ROOT as well.

1
  • Thanks for reply, this works indeed in a view of a component. But in my case it is not the solution. I should be more specific what I want: in the options view of the config component (url: ../administrator/index.php?option=com_config&view=component&component=com_mycomponent), I want to load a specific lay-out. Would this be possible from within the component without 'hacking' the core of Joomla?
    – Franky
    Commented May 11, 2017 at 3:56
1

If you want to add a a custom html into component configuration popup you would have to create your own field type. That way you can manage the layout but still keep your component inside a framework flow and your configuration will be saved. All the custom stylesheets and scripts can be included same as in view templates.

Tutorial on creating custom form field.

https://docs.joomla.org/Creating_a_custom_form_field_type

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.