Skip to content
Module Link Field for Cockpit CMS
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Controller
assets/components
views
LICENSE
README.md
admin.php
bootstrap.php

README.md

Module-Link for Cockpit CMS

ModuleLink Field for Cockpit CMS

This addon is experimental and I'm not sure, if or when I'll work on it again.

Installation

Copy this repository into /addons and name it ModuleLink or

cd path/to/cockpit
git clone https://github.com/raffaelj/cockpit_ModuleLink.git addons/ModuleLink

Usage

Create a new collection with a modulelink field

Do not name a field "link". Weird things may happen, see also: #590. The issue was closed, but it still happens, even without the ModuleLink addon.

Field Options

{
  "module": "collections"
}

or:

{
  "module": "collections",
  "filter": {
    "type": "foo",
    "color": "#FFCE54"
  },
  "display": "_id"
}

filter default: all entries, values must match exact

display default: label || name

Request

https://url.to/cockpit/api/collections/get/collectionname?token=xxtoktenxx

to populate nested module links add:

{
  "populate":"nonsense",
  "populate_module":"1"
}

"populate" must exist to trigger the custom _populate function. "populate":"0" would cause false too early, but "populate":"anystring" is a small hack to still call the method without resolving collection-links.

Be careful with populating too deep if you link in circles. You could produce endless loops...

Output

without population:

    "entries": [
        {
            "mod": [
                {
                    "_id": "modulelinktest5baf427461f97",
                    "name": "modulelinktest",
                    "module": "collections",
                    "display": "modulelinktest"
                }
            ],
            "collectionlink": {
                "_id": "5b771cb933386215c4000193",
                "link": "pages",
                "display": "test no slug"
            },
            "_mby": "5b0fb863a1e1cdoc1879762079",
            "_by": "5b0fb863a1e1cdoc1879762079",
            "_modified": 1538414489,
            "_created": 1538414361,
            "_id": "5bb257193338620a54000092"
        }
    ]

Screenshots

modulelink01

modulelink02

You can’t perform that action at this time.