BarLabels.template_data#
- property BarLabels.template_data: dict[source]#
Dictionary of data to be passed on to jinja templates.
When deriving a new element class, you will often want to redefine this property to add template data. When doing so, remember to retrieve the basic template data with
super()
:import alfred3 as al class NewElement(al.Element): @property def template_data(self): d = super().template_data d["my_value"] = "this is my value" return d # don't forget to return the dictionary!
The call
super().template_data
applies the parent classes code to the current object. That way, you only need to define values that differ from the parent class.Note
Be aware that, by default, the same template data will be passed to
element_template
andbase_template
.- Type