2017 © Pedro Peláez
 

craft-plugin craft-manytomany

A Field Type plugin for Craft 3 that allows the management of relationships from both sides.

image

oberonamsterdam/craft-manytomany

A Field Type plugin for Craft 3 that allows the management of relationships from both sides.

  • Thursday, October 19, 2017
  • by Wiejeben
  • Repository
  • 6 Watchers
  • 0 Stars
  • 10 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 7 Forks
  • 0 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

Archived

This project is now archived, development has been picked up by Verbb and can be found here, (*1)

Many to Many Field Type plugin for Craft 3

Many to Many is a Craft CMS plugin developed by Page 8 and updated to support Craft 3 by Oberon. This plugin allows you to manage relationships in Craft from either of the entries that belong to the association. For example, if you have a recipe with many ingredients, and ingredients that belong to many recipes, you can manage the relationship from either the Recipe's entry or the Ingredient's entry., (*2)

Requirements

This plugin requires Craft CMS 3.0.0-beta.28 or later., (*3)

Installation

To install the plugin, follow these instructions., (*4)

  1. Open your terminal and go to your Craft project:, (*5)

    cd /path/to/project
  2. Then tell Composer to load the plugin:, (*6)

    composer require oberonamsterdam/craft-manytomany
  3. In the Control Panel, go to Settings → Plugins and click the “Install” button for Many to Many Field Type., (*7)

Usage

  1. Create your initial relationship field using the Entries Field Type and attach it to your first section
    • This is done directly through Craft's native "Entries" field type
    • This example assumes this is done on the "Recipes" section creating a field called "Related Ingredients" that allows entries from the Ingredients section Recipes Screen
  2. Create another field that attaches the relationship using the Many to Many field type
    • This is done by creating a new field and selecting the Many to Many field type
  3. Customize your Settings
    • Linked Section will be the initial section that contains the relationship. (in our example Recipes)
    • Associated Field is the field on the other end of this relationship. (in our example Related Ingredients) Settings Screen
  4. Attach the newly created Many to Many field to your section Ingredients Screen

Template Usage

Since this plugin relies on Craft's built in relationships, you can continue to use relationships just as you always have., (*8)

Recipes showing Related Ingredients, (*9)

<h1>Related Ingredients</h1>
{% set relatedIngredients = craft.entries.section('ingredients').relatedTo(entry).all() %}
{% for ingredient in relatedIngredients %}
    {{ ingredient.title }}<br />
{% endfor %}

Ingredients showing Related Recipes, (*10)

<h1>Related Recipes</h1>
{% set relatedRecipes = craft.entries.section('recipes').relatedTo(entry).all() %}
{% for recipe in relatedRecipes %}
    {{ recipe.title }}<br />
{% endfor %}

Version History

See CHANGELOG.md., (*11)

To Do

  1. Allow the field to work across all (or at least more) Element Types. Currently only supports Entries.
  2. Allow custom ordering of the secondary relationship. Currently you can only order the primary relationship (by Craft's native ordering of the Entries field type).
  3. Fix a bug that doesn't allow it to work from the modal tab.
  4. Other stuff I assume.

Notes

  • Currently doesn't support locales
  • As always, use at your own risk

License

This work is licenced under the MIT license., (*12)

The Versions

19/10 2017

dev-master

9999999-dev

A Field Type plugin for Craft 3 that allows the management of relationships from both sides.

  Sources   Download

MIT

The Requires

 

cms craftcms craft-plugin craft fieldtype entries

19/10 2017

dev-namespace-update

dev-namespace-update

A Field Type plugin for Craft 3 that allows the management of relationships from both sides.

  Sources   Download

MIT

The Requires

 

cms craftcms craft-plugin craft fieldtype entries

19/10 2017

1.1.0

1.1.0.0

A Field Type plugin for Craft 3 that allows the management of relationships from both sides.

  Sources   Download

MIT

The Requires

 

cms craftcms craft-plugin craft fieldtype entries

06/10 2017

dev-craft3

dev-craft3

A Field Type plugin for Craft 3 that allows the management of relationships from both sides.

  Sources   Download

MIT

The Requires

 

cms craftcms craft-plugin craft fieldtype entries

20/09 2017

1.0.0

1.0.0.0

A Field Type plugin for Craft 3 that allows the management of relationships from both sides.

  Sources   Download

MIT

The Requires

 

cms craftcms craft-plugin craft fieldtype entries

24/06 2016

dev-dev

dev-dev

A Field Type plugin for CraftCMS that allows the management of relationships from both sides

  Sources   Download

The Requires

 

01/04 2016

0.1.2

0.1.2.0

A Field Type plugin for CraftCMS that allows the management of relationships from both sides

  Sources   Download

The Requires