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

page-8/craft-manytomany

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

  • Thursday, May 17, 2018
  • by Pageworks
  • Repository
  • 6 Watchers
  • 72 Stars
  • 1,121 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 7 Forks
  • 5 Open issues
  • 9 Versions
  • 97 % Grown

The README.md

Many to Many plugin for Craft CMS

Many to Many is a Craft CMS plugin which 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., (*1)

Installation

You can install Many to Many via the plugin store, or through Composer., (*2)

Craft Plugin Store

To install Many to Many, navigate to the Plugin Store section of your Craft control panel, search for Many to Many, and click the Try button., (*3)

Composer

You can also add the package to your project using Composer and the command line., (*4)

  1. Open your terminal and go to your Craft project:
cd /path/to/project
  1. Then tell Composer to require the plugin, and Craft to install it:
composer require verbb/many-to-many && php craft plugin/install many-to-many

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., (*5)

Recipes showing Related Ingredients, (*6)

<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, (*7)

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

Credits

Originally created by Oberon and page.works., (*8)

Show your Support

Many to Many is licensed under the MIT license, meaning it will always be free and open source – we love free stuff! If you'd like to show your support to the plugin regardless, Sponsor development., (*9)

, (*10)

The Versions

17/05 2018

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

17/05 2018

1.0.2.2

1.0.2.2

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

15/05 2018

1.0.2.1

1.0.2.1

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

03/01 2018

1.0.2

1.0.2.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

14/12 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

14/12 2017

3.0.x-dev

3.0.9999999.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

06/07 2016

2.x-dev

2.9999999.9999999.9999999-dev

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

  Sources   Download

The Requires

 

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