wisski_core
The WissKI Core provides the WissKI entity and bundle definitions and their basic management operations like:
-
Entity Management: It defines a
WissKI entityandWissKI bundlewhich are central parts of the module. The WissKI entities and bundle have forms for adding, editing, and deleting, as well as a list builder and controller for managing collections of these entities/bundles. -
Routing: It provides several routes for managing Wisski entities/bundles and settings. These include paths for listing, deleting, and configuring Wisski entities. The
/wisski/getroute resolves Entity URIs and redirects to the canonical view page; see How to resolve Entity URIs. -
Services: It defines several services that provide functionality such as entity querying, route subscribing, and context providing.
-
Controllers and Forms: It includes various controllers and forms that handle the logic for the routes and entities. For example,
WisskiEntityListControllerandWisskiEntityForm. -
Namespace Operator: It includes a
WisskiNameSpaceOperatorservice that likely handles operations related to namespaces in the Wisski system. -
Storage Definition and Database Actions It handles the storage operations for WissKI entities in the databases and includes services that handles database operations related to individual entities in the Wisski system.
Installation¶
wisski_core depends on the contrib module inline_entity_form.
The main WissKI module depends on wisski_core, so enabling WissKI enables it.
drush en wisski_core
Configuration¶
Site-wide WissKI settings are at Configuration → WissKI → WissKI Configuration (/admin/config/wisski/settings).
Bundles and their displays are configured with the bundles of the WissKI entity.
Path, field and view settings of a path live in the Pathbuilder.
Files, images and Media¶
WissKI stores files and images of an entity as Drupal file and image fields that Pathbuilder paths generate. The triplestore holds the file URI; when an entity is loaded, WissKI looks up or creates the matching managed file. The preview image is an image field as well. Mirador and IIP Image read these file URIs.
When an entity is saved, WissKI records the files it uses in Drupal's file usage (module wisski_core, type wisski_individual), so /admin/content/files lists the WissKI entity under Used in. To rebuild these records from the triplestore, run:
drush wisski-core:reconcile-file-usage
Drupal Media is not supported
WissKI does not support Drupal's Media entities or the Media Library:
- Pathbuilder fields can only reference WissKI entities, not Media items.
- A Media reference field added by hand to a WissKI bundle is not saved to the triplestore.
- A file that exists only as a Media item is unknown to WissKI. Its file usage names the Media item, not a WissKI entity.
Use Pathbuilder file or image paths for files of WissKI entities. Media can still be used for other content on the same site, such as nodes.
Sub-groups: the reference dialog widget¶
A sub-group in the Pathbuilder becomes an entity reference field to WissKI entities. New sub-group fields get the form widget WissKI reference dialog (wisski_entity_reference_dialog).
In the entity form, every value of such a field is either empty or filled:
- Empty: only the magnifier (search) and + (create), in this order, each if the settings below allow it.
- The magnifier opens the search popup. Before you type, it lists your favourites and the 5 entities you linked most recently (favourites are not repeated there), each of the field's bundles only. Type a title and press Search to search all titles of the allowed bundles. Click an entry to put it into the field.
- The star next to an entry adds it to your favourites or removes it. Favourites stay until you remove them; recently linked entities are remembered when you save a form. Both lists are personal.
- + opens the form of the referenced bundle in a popup. If the field allows several bundles, it first asks which one. Save in the popup saves the new entity, closes the popup and puts it into the field.
- Filled: the title of the referenced entity, the pencil (edit) and × (remove).
- The pencil opens the full form of the referenced entity in a popup. Save updates the title in the field.
- × asks what to do: Remove reference only keeps the referenced entity. Also delete the entity deletes it as well, but only when you save the form, and like the entity's own delete form (all triples in which it is subject or object). If you cancel the form, nothing is deleted.
- WissKI does not delete the entity if you may not delete it, or if another entity still references it, also through intermediate instances of a path. It also keeps the entity if it cannot check that: the triplestore query fails, the path to a referencing entity is longer than 8 instances, or the entity is referenced by an instance without a WissKI id, e.g. one imported straight into the triplestore. A message on saving says which entities were kept.
In a multi-value field, Add another item appears once no row is empty; × replaces Drupal's remove button of the row.
Popups do not block the rest of the form. Each new popup opens slightly offset on top of the previous one, also for sub-groups inside a popup.
Popups save at once
Save in a popup creates or changes the referenced entity right away, not only when the main form is saved. If you then leave the main form without saving, the new entity stays, but nothing references it.
Titles in the widget and the search come from the WissKI title cache, so the form loads no referenced entity from the triplestore. Results only list entities you may view; references to entities you may not view show - Restricted access -. The widget needs JavaScript.
Settings¶
Manage form display of the bundle sets per field:
| Setting | Default | Meaning |
|---|---|---|
| Reference existing entities | on | The magnifier is shown. |
| Create new entities | on | + is shown when you may create at least one allowed bundle. |
| Dialog width | 800 px | Width of the popups, at most the window width. |
At least one of Reference existing entities and Create new entities must be on: off for the first means only new entities can be created, off for the second means only existing ones can be referenced.
The popup uses the form mode Reference dialog (dialog). Configure a Reference dialog form display for a bundle to show fewer fields in the popup; without one the popup uses the default form display.
Existing fields and Inline Entity Form¶
Fields that already have a widget keep it. Neither drush updb nor saving the Pathbuilder changes the widget of an existing sub-group field; the Pathbuilder only updates its weight. For ordinary paths, widget, formatter, weight and cardinality stay in sync with the Pathbuilder both ways (see Bundle and display sync). drush updb adds the Reference dialog form mode.
To use the reference dialog for an existing field, choose WissKI reference dialog in Manage form display.
WissKI still depends on the Inline Entity Form module, so fields that use an Inline Entity Form widget work as before.