2017 © Pedro Peláez
 

craft-plugin craft-localesync

Sync content to locales on element save.

image

timkelty/craft-localesync

Sync content to locales on element save.

  • Monday, November 20, 2017
  • by timkelty
  • Repository
  • 1 Watchers
  • 27 Stars
  • 1,954 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 5 Open issues
  • 19 Versions
  • 7 % Grown

The README.md

Site-Sync

Synchronize content between sites in a multi-site Craft CMS installation., (*1)

Motivation

In a multi-site configuration, translatable field content is propagated to other sites only on initial save. If you want to edit translatable content and propagate those changes to your other sites, you have to recreate the changes on each site. 🤢, (*2)

Site-Sync allows you to propagate and sychronize changes on a per-field basis, whenever you save an element. In addition to any field content (including Matrix, et al.), it can also sync title and slug content, as those are always translatable in Craft., (*3)

Unlike the Craft 2 version and other similar plugins, this plugin is implemented as a field for a few key reasons:, (*4)

  • It works when saving an element in the HUD.
  • Multiple fields can be created with different default settings.

Installation

$ composer require timkelty/craftcms-site-sync

Usage

Each field layout where you would like to perform syncing must contain a Site-Sync Settings field., (*5)

Site-Sync Settings Field, (*6)

In the field settings you can configure the default state of the field. Note, that unlike most fields, changes to this field do not persist between element saves. They will always revert to the state configured in the field settings., (*7)

Site-Sync Settings Field, (*8)

When you save an entry with a Site-Sync Settings field:, (*9)

  • If the Enabled toggle is on when you save an element, content that matched before saving will be propagated to the other sites.
  • Only content from the selected Sources will be synchronized.
  • Content will only be propagated to sites where the user has permission to save elements.

Nesting (Matrix, Neo, SuperTable, et al.)

If you want to sync nested content, the child fields with the actual content should be translatable, not the parent field (Matrix, etc.) Do not check "Manage blocks on a per-site basis". This setting treats each MatrixBlock as a unique element, and therefore will not sync., (*10)

Should you still wish to make Matrix field your translatable, there is explicit support for Matrix and SuperTable when using the "Overwrite" option. If these fields are translatable, they will sync to other sites _only when "overwrite" is enabled., (*11)

When any element (e.g. MatrixBlock, Entry) is saved, the plugin will traverse up its hierachy (via ElementInterface::getParent) until it finds a Site-Sync Settings field., (*12)

For example, this means you can have a single Site-Sync Settings field on your Entry layout, but a nested MatrixBlock will still find it and use those settings for syncing., (*13)

This also means (if you want to get crazy), that you could include a Site-Sync Settings field on a MatrixBlock to limit the scope of the syncing to that block only. Or, you could include one on the Entry layout and override it with another on a MatrixBlock layout. While this approach is supported, it can get exponentially confusing for the user and likely isn't practical for most uses., (*14)

Roadmap

  • [ ] Support Overwrite + Neo
  • [ ] Leverage deltas for better comparisons
  • [ ] Plugin store
  • [ ] Validate field layouts to only allow 1 of this field type
  • [ ] Value/label usability improvements (toggleLabelId)
  • [ ] Fix compatibility with CP Field Links
  • [ ] Change "Title" name if there is a custom.
  • [ ] Implement getElementValidationRules to add errors to the element
  • [ ] Ensure elements are only saved when they have pending changes (performance)

The Versions

20/11 2017

dev-master

9999999-dev

Sync content to locales on element save.

  Sources   Download

The Requires

 

20/11 2017

1.5.1

1.5.1.0

Sync content to locales on element save.

  Sources   Download

The Requires

 

09/11 2017

1.5.0

1.5.0.0

Sync content to locales on element save.

  Sources   Download

The Requires

 

09/11 2017

dev-element-fields-support

dev-element-fields-support

Sync content to locales on element save.

  Sources   Download

The Requires

 

09/11 2017

1.4.3

1.4.3.0

Sync content to locales on element save.

  Sources   Download

The Requires

 

09/11 2017

1.4.2

1.4.2.0

Sync content to locales on element save.

  Sources   Download

The Requires

 

09/11 2017

1.4.1

1.4.1.0

Sync content to locales on element save.

  Sources   Download

The Requires

 

09/11 2017

1.3.1

1.3.1.0

Sync content to locales on element save.

  Sources   Download

The Requires

 

09/11 2017

1.4.0

1.4.0.0

Sync content to locales on element save.

  Sources   Download

The Requires

 

26/10 2016

1.3.0

1.3.0.0

Sync content to locales on element save.

  Sources   Download

The Requires

 

12/07 2016

1.2.1

1.2.1.0

Sync content to locales on element save.

  Sources   Download

The Requires

 

17/05 2016

1.2.0

1.2.0.0

Sync content to locales on element save.

  Sources   Download

The Requires

 

16/05 2016

1.1.0

1.1.0.0

Sync content to locales on element save.

  Sources   Download

The Requires

 

13/05 2016

1.0.5

1.0.5.0

Sync content to locales on element save.

  Sources   Download

The Requires

 

13/05 2016

1.0.4

1.0.4.0

Sync content to locales on element save.

  Sources   Download

The Requires

 

13/05 2016

1.0.3

1.0.3.0

Sync content to locales on element save.

  Sources   Download

The Requires

 

13/05 2016

1.0.2

1.0.2.0

Sync content to locales on element save.

  Sources   Download

The Requires

 

13/05 2016

1.0.1

1.0.1.0

Sync content to locales on element save.

  Sources   Download

The Requires

 

13/05 2016

1.0.0

1.0.0.0

Sync content to locales on element save.

  Sources   Download

The Requires