How to use theme resources in widget vm file?

How to use theme resources in widget vm file?

Parents
  • What are you trying to do?

    It's true that theme language resources cannot be consumed by anything other than the theme itself.

    However, if potentially you mean "resources" in the more generic sense, it's worth mentioning that the $core_v2_theme extension enables widgets and themes to consume a theme's configuration. And the items in a theme which may be configured are, themselves, also defined by the theme, similar to widgets.

  • Actually I want to set a data in a global variable so that I can use it in multiple widgets.

  • Is this variable intended to be configurable? If so, you can do this with theme configuration, which is then configurable in the theme's configuration panel in the front UI and its value is readable by the theme as well as widgets running within that theme. Please refer to the $core_v2_theme script extension above, as well as your theme's current configuration definitions.

    Or is the variable some sort of programmatic state? If you can shed some more light on what you're trying to achieve, there may be a more optimal solution.

Reply
  • Is this variable intended to be configurable? If so, you can do this with theme configuration, which is then configurable in the theme's configuration panel in the front UI and its value is readable by the theme as well as widgets running within that theme. Please refer to the $core_v2_theme script extension above, as well as your theme's current configuration definitions.

    Or is the variable some sort of programmatic state? If you can shed some more light on what you're trying to achieve, there may be a more optimal solution.

Children
No Data