Overriding renderers

Overriding renderers

by Todd Askens -
Number of replies: 8

Hi,

I've been reading the information about renderers here: http://docs.moodle.org/dev/Overriding_a_renderer (and other pages). I think I'll be able to follow the instructions given to change themes but there's a question that's unanswered by the tutorials.

Is it possible to link the render override to data in the database e.g. if a custom user field has a high contrast check box checked then apply a renderer override? Or have I got this all wrong?

Average of ratings: -
In reply to Todd Askens

Re: Overriding renderers

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Hi Todd,

Your question seems confusing.  Renderers tend to just generate the output based on the data and not change anything.  What are you trying to achieve?

Gareth

In reply to Gareth J Barnard

Re: Overriding renderers

by Todd Askens -

I'm not surprised it's confusing I'm at (or probably beyond( my understanding of things with this.

I want to find a way so that IF there is a value in a user's profile then a renderrer will apply. Is that possible?

In reply to Todd Askens

Re: Overriding renderers

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Ok, given that there is a global $USER variable with contained properties, then I can conceive that it is possible to create a renderer method to react to it.

In reply to Gareth J Barnard

Re: Overriding renderers

by Todd Askens -

Hey, that sounds promising. Are you able to give me a code example of how that might work?

In reply to Todd Askens

Re: Overriding renderers

by Danny Wahl -

going back to what it looks like you're trying to solve (accessibility issue) have you tried installing block_accessibility and setting it up on the /my/ page?  That's what we use.

If that was just an example, then just do what Gareth has suggested.

In reply to Danny Wahl

Re: Overriding renderers

by Todd Askens -

Thanks for that suggestion. I might try that. I was hoping we can make it automatic when users login.

In reply to Todd Askens

Re: Overriding renderers

by Danny Wahl -

it does persist across logins, so once you set it one time it will continue to work.