I'm looking for a way to list all the enabled sites for a given entry. I couldn't find some sort of getEnabledSites method that's similar to the available getSupportedSites. The latter only returns the siteId and enabledByDefault properties.

Note that I'm doing this within the Element API plugin.

  • Do you want to get all available sites for the element or all sites where enabledForSite is true? Jun 6 '18 at 5:02
  • @RobinSchambach I want the latter, i.e. "all sites where enabledForSite is true". The available sites can be retrieved using the getSupportedSites method.
    – biko
    Jun 6 '18 at 5:15

Totally untested but this should work

$enabledSiteIds = (new Query())
        'enabled' => true,
        'elementId' => $elementId

You might want to join the elements and entries table in order to gain only elements where elements.enabled is true too (and check the expiry date), otherwise you'll receive disabled entries

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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