How can i add custom html to a facet api facet block. Like a link to another page or some descriptive text and an image. It would be good for user experience.

You can create your own facet widget. Just extends from one of existing widgets. You can found examples in module facetapi.

  • yes. but then i can not use existing widgets like range slider etc. i only want to add some html text. doing my own widget just for this and all existing widgets cant be used anymore. – marco Jun 5 '14 at 8:55
  • Some widgets use theme function for render his content. You can redefine this function in your theme and include text in this theme function in some situations. – Eugene Jun 5 '14 at 9:32
  • redefine? you mean copy the theme function from a widget that for example does range, and then add my text? then i would have to that for all widgets i have/use. with will be 5. i altered the settings page now and added my custom textfield for the text. now i must somehow insert it into the output, not as a widget as i want to still use my ranged widget. – marco Jun 5 '14 at 11:46

Front-end Developer Solution:

Use one of the following JS functions:

to add some HTML.

ok did it by using form alter and block view alter. so no custom widget is required and all widgets can still be used in addition to mine

  • 1
    Can you expand on your solution? Thanks. – mpdonadio Jun 7 '14 at 11:52
  • well i wrote a small module. should i paste the whole code? i have a drupal.org accound and so will sandbox it some time. – marco Jun 18 '14 at 9:39

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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