4

I have a client site which utilises the SEO lite module. The client has come back with a feature request which I'm trying to figure out a way to achieve: they want to pre-populate the SEO fields on a number of channels using the title and description channel fields, but then allow the admin user to edit those values before saving/publishing.

(I know that in my templates I can can fall back to channel field content if the SEO lite fields are empty, this is more about providing a convenience for the client in filling out the SEO Lite fields)

I'm thinking I can do this by writing a custom extension to inject some JS into the CP on publish/edit forms.

I can write the JS easily enough, but need some advice on the extension side of things.

Questions:

  • Is a custom extension the best route?
  • Can some one point me towards a good template / existing xtn to use as a basis (ie just injects custom JS into the public/edit view, uses similar hooks etc)?
0

2 Answers 2

3

You can pop your JS into the instructions of one of the fields on that form. Will be the quickest solution IMO.

OR you can use this Extension to add custom CSS/JS to the CP: http://devot-ee.com/add-ons/cp-css-js

4
  • that's a genius idea for one off bits of JS, but I need this to work across multiple channels (will update my qn accordingly) - guessing this would require me to add that JS to the instructions of field on each channel separately?
    – Tom Davies
    Nov 21, 2012 at 19:03
  • Or just set up a field that is minimized with a title that says "Admin Only" or something and add it to each channel.
    – Anna_MediaGirl
    Nov 21, 2012 at 19:07
  • 1
    I guess my concern was that there are still then multiple copies of that JS (one per field group, and in the DB rather than a flat file) in case it needs refactoring/debugging.
    – Tom Davies
    Nov 21, 2012 at 19:09
  • 1
    Ah, I see what you're saying... Indeed. I just edited my answer and added a link to an Extension which will allow you to add custom JS to the CP. I haven't used it before but it should do the trick.
    – Anna_MediaGirl
    Nov 21, 2012 at 19:12
1

I could be completely off with this but I wanted to add some JavaScript stuff to the View Members page. MX Cloner had just the bit of functionality I was looking for: Replace a link on the screen with a hover effect given the proper URL and a way to place JavaScript in the CP. This may not be the best or even proper route to go, but it was the most convenient route for me being pretty new and all.

You could easily make a copy of that accessory to pull the defaults from SEO Lite. I haven't used SEO Lite yet so no comment on that.

Your Answer

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

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