Providence application plugin that derives ca_object_representations.idno from the uploaded media filename and fills a blank preferred label from the same filename.
- Sets representation
idnofromoriginal_filenameon new uploads. - Sets representation preferred label from
original_filenamewhen the label would otherwise be blank. - Optionally strips the filename extension before generating values.
- Optionally updates
idnowhen media is replaced and the stored filename changes. - Optionally updates a blank preferred label when media is replaced and the stored filename changes.
- Preserves explicitly entered
idnovalues on insert. - Preserves manual
idnoedits on update when configured to do so. - Ensures generated
idnovalues are unique by appending a numeric suffix when needed.
This plugin is aimed at ordinary Providence editor uploads, especially Object > Media, where teams may want:
- consistent representation identifiers based on filenames
- a human-readable representation title when no preferred label was entered
- no Providence core patches
Batch media import already has built-in filename-to-identifier options in stock Providence. This plugin is primarily for interactive editor workflows.
Copy the plugin directory to:
app/plugins/representationFilenameIdno
Create a server-local config file at:
app/plugins/representationFilenameIdno/conf/plugin.local.conf
using this example as a starting point:
app/plugins/representationFilenameIdno/conf/plugin.local.conf.example
Recommended pattern:
- Leave
conf/plugin.confin version control withenable = 0 - Enable and tune behavior only in
conf/plugin.local.conf - Restart Apache or PHP-FPM if opcache is enabled
With the shipped example config:
- the plugin is enabled only in
plugin.local.conf idnois generated from the uploaded filename without the file extension- blank preferred labels are filled from the same filename
- media replacement updates
idnoand blank labels when the filename changes - duplicate generated
idnovalues receive-2,-3, and so on
Example:
- upload
Scan 001.tif - generated
idno:Scan_001 - generated preferred label when blank:
Scan_001
enable
- Turns the plugin on or off.
strip_extension
- Removes the final filename extension before generating
idnoand preferred label values.
preserve_existing_idno_on_insert
- Leaves a pre-existing
idnoalone when a new representation is saved.
sync_on_media_replace
- Updates
idnowhen an existing representation gets a new media file with a different stored filename.
preserve_manual_idno_on_update
- Prevents replacement-time
idnosync if the user also changedidnoin the same save.
set_preferred_label_from_filename_when_blank
- Fills the representation preferred label from filename only when Providence would otherwise leave it blank.
update_blank_preferred_label_on_media_replace
- Repeats that blank-label fallback when media is replaced.
replace_whitespace_with
- Replaces runs of whitespace with the configured character or string.
lowercase
- Lowercases generated
idnovalues and generated label text.
ensure_unique
- Appends numeric suffixes to generated
idnovalues if needed.
suffix_separator
- Separator used before uniqueness suffixes.
- No Providence core changes are required.
- Interactive uploads in the Object > Media bundle are supported.
- Full representation edits are supported for new records and media replacement updates.
- Preferred labels are only auto-filled when blank; the plugin does not overwrite an existing nonblank label.