This project is not covered by Drupal’s security advisory policy.

INTRODUCTION

Separate form to add a distribution to an existing DKAN dataset.

In DKAN, datasets and distributions are both data nodes, told apart by field_data_type. Adding a distribution normally means editing the whole dataset. This module provides a form that only shows the distribution fields and a select field to choose the dataset.

Features

  • Form at /node/add-distribution with the distribution fields of the dataset JSON form (including file upload or link for the download URL) and a select field for the dataset.
  • Preselect a dataset with ?dataset=<dataset identifier>, e.g. to link to the form from a dataset page.
  • "Add distribution" button on the DKAN datasets list (/admin/dkan/datasets) and a menu link under DKAN > Datasets.
  • The dataset including the new distribution is validated against the dataset schema before it is saved. Validation errors are shown on the form.
  • Uses Select2 for the dataset field if the module is installed.

How it works

The form doesn't create the distribution node itself. It appends the new distribution to the distribution property of the dataset and saves the dataset through the DKAN metastore (MetastoreService::patch()). DKAN then creates the distribution node and registers the file, as it does when a dataset is saved with the normal form.

The fields come from the distribution schema, the widgets from the distribution items in dataset.ui, so the form looks like the distribution part of the dataset form. Empty sub-objects that only contain their type (e.g. {"type": "foaf:page"} from schema defaults) are removed before saving.

REQUIREMENTS

INSTALLATION

Install as you would normally install a contributed Drupal module. See: https://www.drupal.org/node/895232 for further information.

CONFIGURATION

Grant the permission "Add distribution to dataset" to the roles that should use the form. Users also need access to the datasets they want to choose.

MAINTAINERS

Current maintainers:

Supporting organizations: 

Project information

Releases