{"id":21139360,"url":"https://github.com/deuxhuithuit/entry_relationship_field","last_synced_at":"2025-06-25T13:03:50.218Z","repository":{"id":15708226,"uuid":"18446207","full_name":"DeuxHuitHuit/entry_relationship_field","owner":"DeuxHuitHuit","description":"A new way to create master-details pattern with Symphony's sections","archived":false,"fork":false,"pushed_at":"2020-03-13T15:17:05.000Z","size":475,"stargazers_count":11,"open_issues_count":16,"forks_count":13,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-04-09T21:27:28.835Z","etag":null,"topics":["php","symphony-cms","symphony-cms-extension","xslt"],"latest_commit_sha":null,"homepage":"http://symphonyextensions.com/extensions/entry_relationship_field/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DeuxHuitHuit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-04-04T17:12:51.000Z","updated_at":"2019-11-12T21:17:56.000Z","dependencies_parsed_at":"2022-09-22T08:43:00.259Z","dependency_job_id":null,"html_url":"https://github.com/DeuxHuitHuit/entry_relationship_field","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeuxHuitHuit%2Fentry_relationship_field","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeuxHuitHuit%2Fentry_relationship_field/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeuxHuitHuit%2Fentry_relationship_field/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeuxHuitHuit%2Fentry_relationship_field/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DeuxHuitHuit","download_url":"https://codeload.github.com/DeuxHuitHuit/entry_relationship_field/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225482441,"owners_count":17481213,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["php","symphony-cms","symphony-cms-extension","xslt"],"created_at":"2024-11-20T07:01:45.844Z","updated_at":"2024-11-20T07:06:35.732Z","avatar_url":"https://github.com/DeuxHuitHuit.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Entry Relationship Field [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/DeuxHuitHuit/entry_relationship_field/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/DeuxHuitHuit/entry_relationship_field/?branch=master)\n\n\u003e A new way to create master-details (parent -\u003e children) relationships with Symphony's sections.\n\n### SPECS\n\n- Supports multiple sections for the same relationship.\n- Offers developers the possibility to create xslt templates for the field's backend UI.\n- Offers a modal UI in order to create/edit for the children.\n- Compatible with Symphony associations.\n- Supports multiple level (recursive) of associations.\n- Aims to be compatible with *all* fields.\n\n### REQUIREMENTS\n\n- Symphony CMS version 2.7.3 and up (as of the day of the last release of this extension)\n\n### INSTALLATION\n\n- `git clone` / download and unpack the tarball file\n- Put into the extension directory\n- Enable/install just like any other extension\n\nYou can also install it using the [extension downloader](http://symphonyextensions.com/extensions/extension_downloader/).\nJust search for `entry_relationship_field`.\n\nFor more information, see \u003chttp://getsymphony.com/learn/tasks/view/install-an-extension/\u003e\n\n### UPDATE FROM 1.0.x\n\nSome developers may have been relying on some bugs in the xslt templates which may break when updating from versions before 2.0.0.\nIn fact, under some circumstance, the field would output only their default mode instead of all of them.\nIf this is the case, your either have to be more precise in your XPath queries or in the field's includable elements.\n\n### HOW TO USE\n\n- Go to the section editor and add an Entry Relationship field.\n- Give it a name.\n- Select at least one section that will be permitted as children.\n- Select also the fields you want to be available in the backend templates and data sources.\n    - `x-` prefixed attributes are only available in devkit mode.\n- [Create backend templates](#backend-templates) in the `workspace/er-templates` folder.\n    - The name of the file must be `included-section-handle.xsl`\n    - You need at least one template that matches `entry`\n    - Protip: add `?debug` to backend url to see the available xml for each entry.\n    - Protip: You can also override the default debug template with     \n    `\u003cxsl:template match=\"/data\" mode=\"debug\" priority=\"1\"\u003e\u003c/xsl:template\u003e`\n    - Protip: You can create action buttons yourself, using the [data-attribute api](#Data-attribute-API).\n- (Optional) Select a maximum recursion level for nested fields.\n- (Optional) Select a minimum and maximum number of elements for this field.\n- (Optional) Select an xsl mode to be able to support multiple templates for the same section.\n- (Optional) Select an xsl mode to customize the publish table view.\n- (Optional) Select an xsl mode to customize the publish action bar.\n- (Optional) Create some Reverse Relationship fields to be able to manage the relation in both sections!\n\nThere is also a [screen cast available](https://www.screenr.com/pDDN)\n\n### Backend templates\n\n#### Entries / publish view templates\n\nHere's what a basic backend template should look like.\n\n```xslt\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003cxsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"\u003e\n\n\u003cxsl:template match=\"entry\"\u003e\n    \u003cdiv\u003e\n        \u003ch1\u003e\n            \u003cxsl:value-of select=\"./*[1]\" /\u003e\n        \u003c/h1\u003e\n    \u003c/div\u003e\n\u003c/xsl:template\u003e\n\n\u003c/xsl:stylesheet\u003e\n```\n\n#### Field action bar template\n\nBeware: this template must be in a xsl file named like the current section's handle (not the targeted sections)\n\n```xslt\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003cxsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"\u003e\n\n\u003cxsl:template match=\"field\" mode=\"[field settings mode]\"\u003e\n    \u003cdiv\u003e\n        \u003cxsl:if test=\"allow-new = 'yes'\"\u003e\n            \u003cbutton type=\"button\" class=\"create\" data-create=\"[section-id]\"\u003eCustom create new\u003c/button\u003e\n        \u003c/xsl:if\u003e\n    \u003c/div\u003e\n\u003c/xsl:template\u003e\n\n\u003c/xsl:stylesheet\u003e\n```\n\n#### Default templates\n\nSince version 2.0.0, the extension ships with default xsl templates that can be imported in your customized templates.\nAlso, feel free to copy and change them as required for your current project.\n\n```xslt\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003cxsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"\u003e\n\n\u003cxsl:import href=\"../../extensions/entry_relationship_field/er-templates/action-bar.xsl\" /\u003e\n\u003cxsl:import href=\"../../extensions/entry_relationship_field/er-templates/entry.xsl\" /\u003e\n\n\u003cxsl:template match=\"entry\"\u003e\n    \u003cxsl:apply-templates select=\".\" mode=\"content\" /\u003e\n\u003c/xsl:template\u003e\n\n\u003cxsl:template match=\"entry\" mode=\"[field settings mode for publish table view]\"\u003e\n    \u003cxsl:apply-templates select=\".\" mode=\"table-view\" /\u003e\n\u003c/xsl:template\u003e\n\n\u003cxsl:template match=\"field\" mode=\"[field settings mode for the action bar]\"\u003e\n    \u003cxsl:apply-templates select=\".\" mode=\"action-bar\" /\u003e\n\u003c/xsl:template\u003e\n\n\u003c/xsl:stylesheet\u003e\n```\n\n### Data-attribute API\n\nIn your backend template, you can create button that uses the same features as the default ones.\nThe only markup needed is a data-attribute on the button.    \nThe provided actions are:\n\n- Edit entry `data-edit=\"{entry-id}\"`\n- Unlink entry `data-unlink=\"{entry-id}\"`\n- Link entry `data-link=\"{section-handle}\"`\n- Search entry `data-search=\"{section-handle}\"`\n- Delete entry `data-delete=\"{entry-id}\"`\n- Create entry `data-create=\"{section-handle}\"`\n- Replace entry `data-replace=\"{entry-id}\"`\n- Orderable handle selector `data-orderable-handle=\"\"`\n- Collapsible selectors\n    - Handle `data-collapsible-handle=\"\"`\n    - Content `data-collapsible-content=\"\"`\n- Insert a specified index `data-insert=\"\"` (only valid with `data-create` and `data-link`)\n    - Leaving the `data-insert` attribute empty will make the insertion after the current entry.\n    - Setting a number will insert after that index.\n    - Setting -1 will insert before the current entry.\n\nAttribute value is always optional: It will revert to the closest data-attribute it can find in the DOM.\n\nIf you are trying to act on unrelated sections, add the `data-section=\"{section-handle}\"` attribute alongside the action one.\n\nThe search features uses Symphony's suggestion jQuery plug-in. In order for it to work in your template,\nuse the following html.\n\n```html\n\u003cdiv data-interactive=\"data-interactive\"\u003e\n    \u003cinput data-search=\"\" placeholder=\"Search for entries\" autocomplete=\"off\"\u003e\n    \u003cul class=\"suggestions\"\u003e\u003c/ul\u003e\n\u003c/div\u003e\n```\n\n*No validation is made to check if the feature has been activated in the field's settings.*\nThe template developer must properly check which setting is enabled in the field's xml.\n\n### AKNOWLEDGMENTS\n\nThis field would not have been created if some other people did not released some really \ncool stuff. We would like to thanks everybody that contributed to those projects:\n\n- [symphonycms/selectbox_link_field](https://github.com/symphonycms/selectbox_link_field)\n- [hananils/subsectionmanager](https://github.com/hananils/subsectionmanager)\n- [psychoticmeow/content_field](https://github.com/psychoticmeow/content_field)\n\nWe basically trashed things that were not necessary and re-implemented things that we liked\nfrom those extensions.\n\n### LICENSE\n\n[MIT](https://deuxhuithuit.mit-license.org)\n\nMade with love in Montréal by [Deux Huit Huit](https://deuxhuithuit.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeuxhuithuit%2Fentry_relationship_field","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeuxhuithuit%2Fentry_relationship_field","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeuxhuithuit%2Fentry_relationship_field/lists"}