2.3.1releasedField: Entry Relationship
A new way to create master-details (parent -> children) relationships with Symphony's sections.
Clone URLhttps://github.com/DeuxHuitHuit/entry_relationship_field.git
Add as a submodulegit submodule add https://github.com/DeuxHuitHuit/entry_relationship_field.git extensions/entry_relationship_field --recursive
Compatibility
2.x.x | 2.1.x | 2.2.x | 2.3.x | 2.4.x | 2.5.x | 2.6.x | 2.7.0 | 2.7.1 | 2.7.2 | 2.7.3 | 2.7.4 | 2.7.5 | 2.7.6 | 2.7.7 | 2.7.8 | 2.7.9 | 2.7.10 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
No | No | No | No | No | 1.0.3 | 1.0.3 | 2.0.2 | 2.0.2 | 2.0.2 | 2.3.1 | 2.3.1 | 2.3.1 | 2.3.1 | 2.3.1 | 2.3.1 | 2.3.1 | 2.3.1 |
Readme
Entry Relationship Field 
A new way to create master-details (parent -> children) relationships with Symphony's sections.
SPECS
- Supports multiple sections for the same relationship.
- Offers developers the possibility to create xslt templates for the field's backend UI.
- Offers a modal UI in order to create/edit for the children.
- Compatible with Symphony associations.
- Supports multiple level (recursive) of associations.
- Aims to be compatible with all fields.
REQUIREMENTS
- Symphony CMS version 2.7.3 and up (as of the day of the last release of this extension)
INSTALLATION
git clone
/ download and unpack the tarball file- Put into the extension directory
- Enable/install just like any other extension
You can also install it using the extension downloader.
Just search for entry_relationship_field
.
For more information, see http://getsymphony.com/learn/tasks/view/install-an-extension/
UPDATE FROM 1.0.x
Some developers may have been relying on some bugs in the xslt templates which may break when updating from versions before 2.0.0. In fact, under some circumstance, the field would output only their default mode instead of all of them. If this is the case, your either have to be more precise in your XPath queries or in the field's includable elements.
HOW TO USE
- Go to the section editor and add an Entry Relationship field.
- Give it a name.
- Select at least one section that will be permitted as children.
- Select also the fields you want to be available in the backend templates and data sources.
x-
prefixed attributes are only available in devkit mode.
- Create backend templates in the
workspace/er-templates
folder.- The name of the file must be
included-section-handle.xsl
- You need at least one template that matches
entry
- Protip: add
?debug
to backend url to see the available xml for each entry. - Protip: You can also override the default debug template with
<xsl:template match="/data" mode="debug" priority="1"></xsl:template>
- Protip: You can create action buttons yourself, using the data-attribute api.
- The name of the file must be
- (Optional) Select a maximum recursion level for nested fields.
- (Optional) Select a minimum and maximum number of elements for this field.
- (Optional) Select an xsl mode to be able to support multiple templates for the same section.
- (Optional) Select an xsl mode to customize the publish table view.
- (Optional) Select an xsl mode to customize the publish action bar.
- (Optional) Create some Reverse Relationship fields to be able to manage the relation in both sections!
There is also a screen cast available
Backend templates
Entries / publish view templates
Here's what a basic backend template should look like.
```xslt <?xml version="1.0" encoding="UTF-8"?>
```
Field action bar template
Beware: this template must be in a xsl file named like the current section's handle (not the targeted sections)
```xslt <?xml version="1.0" encoding="UTF-8"?>
```
Default templates
Since version 2.0.0, the extension ships with default xsl templates that can be imported in your customized templates. Also, feel free to copy and change them as required for your current project.
```xslt <?xml version="1.0" encoding="UTF-8"?>
```
Data-attribute API
In your backend template, you can create button that uses the same features as the default ones.
The only markup needed is a data-attribute on the button.
The provided actions are:
- Edit entry
data-edit="{entry-id}"
- Unlink entry
data-unlink="{entry-id}"
- Link entry
data-link="{section-handle}"
- Search entry
data-search="{section-handle}"
- Delete entry
data-delete="{entry-id}"
- Create entry
data-create="{section-handle}"
- Replace entry
data-replace="{entry-id}"
- Orderable handle selector
data-orderable-handle=""
- Collapsible selectors
- Handle
data-collapsible-handle=""
- Content
data-collapsible-content=""
- Handle
- Insert a specified index
data-insert=""
(only valid withdata-create
anddata-link
)- Leaving the
data-insert
attribute empty will make the insertion after the current entry. - Setting a number will insert after that index.
- Setting -1 will insert before the current entry.
- Leaving the
Attribute value is always optional: It will revert to the closest data-attribute it can find in the DOM.
If you are trying to act on unrelated sections, add the data-section="{section-handle}"
attribute alongside the action one.
The search features uses Symphony's suggestion jQuery plug-in. In order for it to work in your template, use the following html.
html
<div data-interactive="data-interactive">
<input data-search="" placeholder="Search for entries" autocomplete="off">
<ul class="suggestions"></ul>
</div>
No validation is made to check if the feature has been activated in the field's settings. The template developer must properly check which setting is enabled in the field's xml.
AKNOWLEDGMENTS
This field would not have been created if some other people did not released some really cool stuff. We would like to thanks everybody that contributed to those projects:
We basically trashed things that were not necessary and re-implemented things that we liked from those extensions.
LICENSE
Made with love in Montréal by Deux Huit Huit
Version history
Symphony 2.7.3 to 2.x.x
- Fix ajax save when no entries linked (#82)
Symphony 2.7.3 to 2.x.x
- Fix for field name selection that was not properly working
- Add support for selecting system dates (creation/modification)
Symphony 2.7.3 to 2.x.x
- Fix missing $
- Fix broken field section in Datasources
Symphony 2.7.3 to 2.x.x
- Add support for drawers (except filtering)
Symphony 2.7.3 to 2.x.x
- Fix a bug when upgrading from < 2.0.0
Symphony 2.7.3 to 2.x.x
- Fix a problem with the absence of unload events when removing the iframe
Symphony 2.7.3 to 2.x.x
- Fix initial value for reverse relationship
- Fix problem with association counts and getting the timestamp
Symphony 2.7.3 to 2.x.x
- Add French language file
Symphony 2.7.3 to 2.x.x
- Prevent error when saving a field that links to an invalid section
Symphony 2.7.3 to 2.x.x
- Fix broken install SQL (#75)
Symphony 2.7.3 to 2.x.x
- Fix a problem with the replace function (#74)
- Add XSLT output for reverse relationship
- Add sort to reverse relationship
Symphony 2.7.0 to 2.x.x
- Make fetchIncludableElements() return ['*'] (#72)
- Prevent infinite loop in circular schemas
- Compare rather than set so we can view the raw XML view (#73)
Symphony 2.7.0 to 2.x.x
- Replace fadeIn by fadeTo to avoid sizing problems
Symphony 2.7.0 to 2.x.x
- Fix issue with subfield selection (#70)
Symphony 2.7.0 to 2.x.x
- Remove debug attribute from production xml
Symphony 2.7.0 to 2.x.x
- Added deepness check in SectionsInfos fetch
Symphony 2.7.0 to 2.x.x
- Added support for publish filtering and DS filtering by value (#48)
- Added support for basic search (#47)
- Added support for parent associations
- Added the Reverse Relationship Field (#43)
- Better UI for the selection of included elements (#57)
- Fixed frontend event form markup (#54)
- Allow collapsing of entries content (#16)
- Fixed some bugs regarding data-source output (#55) which may impact the compatibility with previous xstl templates
- Fixed some minor UI quirks
- Added the ability to create XSL templates for the publish table view (#45)
- Added the ability to create XSL templates for the header in the publish view (#29)
- Always show the unlink button when the entry is not found (#51)
- Added the ability to hide the header in entries templates (#58)
- Added the ability to create XSL templates for the publish action bar (#59)
- Supported on PHP 7 (#65)
Symphony 2.5.0 to 2.6.x
- Added a un-link button.
- Entries can now be deleted straight from the field UI.
- Fixed some other minor bugs
- Add a ESC key shortcut to close the popup (#17)
- Show the minimum and the maximum of entries allowed (#18)
- Added a data-attribute based API for the backend (#30)
- Section choice is now saved in local storage
Symphony 2.5.0 to 2.6.x
- Changed the column type for entries to TEXT to allow more entries to be linked
- Fixed a ton of bugs (#44, #42, #40, #38, #34, #33, #31, #26, #25, #24, #23, #22, #21, #20, #19, #11, #5, #4, #2)
- Most of the data-* api is done (See #30)
- Added options to hide link, new and edit buttons
- Better error management for the ajax save
- Added basic filtering (only works with entry id)
Symphony 2.5.0 to 2.5.x
- Fix a bug that was preventing the render. Fixes #14
- Outputs all modes (formatted/unformatted). Fixes #7
- Only save via ajax if value changed. Fixes #6
- Do not output * in includable elements. Fixes #9
- Display real count of linked elements. Fixes #13
- Added section name in the DS xml. Fixes #12
- Turn off filtering. Re: #11
- Re-render after save or create. Re: #1
- Save the field value when it changes. Fixes #1
- Always show linking section. Fixes #3
- Added some xml params into backend templates. Fixes #8
- Added runtime params. Fixes #8
- Better debug visual
Symphony 2.5.0 to 2.5.x
- First release