Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: Mailchimp 3.1.5 Minor update available for module mailchimp (3.1.5). Release: Commerce Shipping 3.0.5 Minor update available for module commerce_shipping (3.0.5). Release: GoogleTag Manager 2.0.1 Minor update available for module gtm (2.0.1). Usage Milestone: Easy Breadcrumb Module easy_breadcrumb crossed 100,000 active installs. Release: MCP Sentinel 2.17.0 Minor update available for module mcp_sentinel (2.17.0). Release: Commerce ML Exchange 2.0.1 Minor update available for module cmlexchange (2.0.1). Release: Commerce ML Exchange 2.0.0 Major update available for module cmlexchange (2.0.0). Release: SynImport 2.0.0 Major update available for module synimport (2.0.0). Release: Contact ajax 3.0.0 Major update available for module contact_ajax (3.0.0). Module Revived: Contextual Filter from Referer 1.0.2 Module contextual_filter_referer updated after 22 months of inactivity (1.0.2).

Agrovocfield

3 sites Security covered Drupal 10–11
View on drupal.org

This module automatically suggests AGROVOC taxonomy tags for content by analyzing text from another field. It connects to a self-hosted AgroTagger service to fetch relevant tags and populates a taxonomy reference field, only when the field is empty. It also normalizes AGROVOC URIs for better link functionality.

Suggests AGROVOC taxonomy tags for content by calling a self-hosted AgroTagger service. Drupal 11 port of the legacy Drupal 7 agrovocfield_automatic sub-module, renamed to agrovocfield for this site.

What it does

When editing content, this module can automatically suggest AGROVOC concept tags for a taxonomy reference field, based on the text in another field on the same content (e.g. the body). It only fills the field when the editor has left it empty — it never overwrites tags an editor picked or already-saved tags.

On save, if automatic indexing is enabled for a field:

  1. The module reads the just-submitted value of the configured "source" field.
  2. It calls the self-hosted AgroTagger HTTP service (POST /tag) with that text.
  3. For each AGROVOC concept returned, it looks up or creates a matching taxonomy term in the field's target vocabulary. Newly created terms get their canonical AGROVOC URI stored in a field_agrovoc_uri link field, if the vocabulary has one.
  4. It populates the field with those terms before the entity is saved.

This all happens inside an #element_validate callback, so it only runs during interactive form submission — never during programmatic saves, migrations, or content imports.

AGROVOC URI linking

If the target vocabulary has a field_agrovoc_uri link field (as the "Tags" vocabulary on this site does), the module:

  • Normalizes the legacy AIMS URI the AgroTagger service returns (http://aims.fao.org/aos/agrovoc/c_XXXX) to the canonical URL it redirects to today (https://aims.fao.org/aos/agrovoc/c_XXXX.html), avoiding a multi-hop redirect chain on every click.
  • Stores it on the term, so it renders as a normal clickable link wherever the term's own fields are displayed (e.g. the term's own page, if field_agrovoc_uri is enabled in its "Manage display" settings).

Separately, the Tagify widget's own built-in "Include info label" setting can show this URI directly inside each tag pill while editing — set the widget's "Info label content" to the token [term:field_agrovoc_uri]. This is a standard Tagify feature, not something this module adds; it just needs field_agrovoc_uri to exist and be populated, which this module handles.

Terms without this field are unaffected. For terms created beforefield_agrovoc_uri existed (or matched by name to a pre-existing term rather than auto-created), the URI isn't set automatically — but it can be backfilled after the fact using the AgroTagger service's GET /lookup?label= endpoint (a direct dictionary lookup against the same label→URI mapping used for tagging, added specifically for this). There's no UI for this yet; it's a one-time drush php:script that loads every term in a bundle with field_agrovoc_uri, skips any that already have a value, calls /lookup for the rest, and saves the normalized URI for whatever matches. Not run automatically — re-run it manually if more untagged legacy terms show up later.

Requirements

  • A running AgroTagger service reachable from this Drupal installation over HTTP. This module only speaks the service's POST /tag / GET /lookup JSON API — it doesn't care how or where that service is hosted, as long as the URL configured below can reach it. In this deployment, that service is a self-hosted Java HTTP wrapper around the MAUI keyphrase-extraction library, running as a K3s Deployment/Service in this cluster and reached internally at http://agrotagger:8080. Full instructions for building, configuring, and running that self-hosted service (Docker/Kubernetes deployment, standalone Docker Compose, its HTTP API, and its data sources) live in github.com/asanchez75/agrotagger .€” This module doesn't duplicate that documentation, it just consumes the API it exposes.

  • A taxonomy reference field using one of the two supported widgets:

    • Core's Autocomplete (Tags style) widget (entity_reference_autocomplete_tags)
    • The Tagify contrib module's widget (tagify_entity_reference_autocomplete_widget)

    These are the only widgets supported — both are "tags style" widgets (a single multi-value element per field, not one element per delta), matching what the original Drupal 7 module supported via core's taxonomy_autocomplete widget. Other entity reference widgets are silently ignored.

Configuration

Service connection: Configuration → Content authoring → AGROVOC Field (/admin/config/content/agrovocfield). Sets the AgroTagger service base URL (default http://agrotagger:8080, the in-cluster service DNS name) and the request timeout.

Per-field settings: Structure → Content types → [type] → Manage form display, then the widget settings (gear icon) for the taxonomy reference field. Below the widget's own settings you'll find:

  • Enable AGROVOC automatic indexing — on/off for this field.
  • Field to index — which other field on the same content supplies the source text.
  • Maximum number of tags to suggest — caps how many AGROVOC concepts get applied.

Known limitations

  • The AgroTagger service's bundled model (agrovoc_en) is English-only. Non-English content will produce poor or nonsensical tags — this is a model limitation, not a bug in this module.
  • Tag suggestions currently have no confidence score (score is always null in the service's response) — the underlying MAUI extraction pipeline's output file format only ever exposed plain keyword labels, not a confidence value alongside each one, so there's nothing to surface yet even though the response shape reserves the field.
  • Requires the source field to be plain or lightly-formatted text; HTML is stripped before sending to the tagging service, but no other content extraction happens (no PDF/file support).
  • Backfilling existing terms' AGROVOC URI is a manual one-time script, not an automatic or scheduled process (see "AGROVOC URI linking" above) — it won't pick up newly unlinked terms on its own.

Depends on

Dependencies of the latest stable release

  • field Drupal core
  • taxonomy Drupal core

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
3
Tracked since
Aug 2026
Latest release
1 month ago
Releases (12 mo)
3 ▲ from 0
Maintenance
Active

Release Timeline

Releases

Version Type Core Release date
1.0.2 Stable 10–11 Aug 5, 2026
1.0.x-dev Dev 10–11 Aug 5, 2026
1.0.1 Stable 10–11 Aug 5, 2026