lewisjenkins / craft-dynamic-fields

Populate Craft fields with dynamic data using the power of Twig.
Other
147 stars 11 forks source link

Multi-Site functionality #43

Open maxstrebel opened 2 years ago

maxstrebel commented 2 years ago

First of all: thanks for this plugin. We're currently trying to use it for a "Theme" Dropdown. But it seems the CP does not share the currently active site anymore.

Each of our sites should be able to define custom themes, which then are output in the dropdown.

Unfortunately the queries always return the entries or globals for the default site. No matter on which site you're editing the entry.

I tried

{# Should return themes from the site in which I edit the entry #}
{% set themes = craft.entries.section("themes").all() %}

{# Should return global set in which I edit the entry - table with handle "customThemes", global Set with handle "themes" #}
{% set themes = themes.customThemes %}

{# I tried to reference the site in the backend #}
{% set themes = craft.globalSets()
  .handle("themes")
  .site(currentSite)
  .one()
%}

Do you know this problem?

maxstrebel commented 2 years ago

I just saw the Pull-request. Do you consider to merge this at some point?