Skip to content
This repository has been archived by the owner on Jan 9, 2021. It is now read-only.

Nav33d/craft-relations

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Relations plugin for Craft CMS 3

A field type to show reverse related elements.

Requirements

This plugin requires Craft CMS 3.0.0 or later.

Installation

To install the plugin, follow these instructions.

  1. Open your terminal and go to your Craft project:
cd /path/to/project
  1. Then tell Composer to load the plugin:
composer require nav33d/craft-relations
  1. In the Control Panel, go to Settings → Plugins and click the “Install” button for Relations.

Screenshots

Screenshot

Screenshot

Accessing relations in template

You can access relations in template using your field handle. Lets say your field is called relations, you can use the following code block to access relations:

{% if entry.relations %}
  {% for item in entry.relations %}
    <h2>{{ item.title }}</h2>
  {% endfor %}
{% endif %}

Credits

Brought to you by Naveed Ziarab