Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Craft 3 Field type that allows the selection of Craft sites and propegates the entries.

License

Notifications You must be signed in to change notification settings

wirelab/craft3-sites-propegation-field

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sites Field for Craft 3

This plugin provides a field type for choosing sites. Entries using this field can then access the site ID in their templates.


Requirements

  • Craft CMS 3.0.0-RC1 or above

Example Usage

To display only events related to the current site you could use the following logic:

{% set events = craft.entries.site('main').section('blog').type('event').orderBy('date asc').all() %}
{% for event in events %}
  {% if craft.app.sites.currentSite.id in event.siteIds %}
    {# show this event... #}
  {% endif %}
{% endfor %}

Note: siteIds returns an array of site ID's which you can use the twig in operator.

About

Craft 3 Field type that allows the selection of Craft sites and propegates the entries.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 81.1%
  • HTML 18.9%