Blog Sections Open

Auto-Filling TV Values from Parent or Page Context in Evolution CMS

A small but useful content-modeling pattern for keeping repeated TV values in sync with the current document context.

Sometimes a TV does not need to be entered manually at all. If its value is derived from the current page, the parent resource, or another predictable field, making editors retype it only creates inconsistency.

The original question was simple: can a TV be filled automatically from the page title? The broader answer is yes, and the same idea applies to parent values, section labels, inherited metadata, and routing hints.

When auto-fill makes sense

  • The TV should mirror pagetitle, longtitle, or alias.
  • The TV should inherit a default value from the parent resource.
  • The field is only used for frontend helpers and should stay consistent automatically.

Typical implementation options

In classic Evo builds this is often handled through a plugin on save events, or through manager-side JavaScript when one field changes another. In newer controller-driven setups it is usually cleaner to enforce the value in the save layer itself.

if (empty($tvValue)) {
    $tvValue = $document['pagetitle'];
}

Why plugins are often better than manual editing

If the TV exists only to duplicate information the document already has, automatic population makes the content model simpler and safer. Editors keep one source of truth, and templates can still use the TV if that is what the project already expects.

Good guardrails

  • Only auto-fill when the target TV is empty, unless the project explicitly wants hard synchronization.
  • Document which fields are derived automatically so editors do not try to maintain them manually.
  • Avoid circular logic where one derived field depends on another derived field.

This is a small refinement, but on larger projects it removes a surprising amount of repetitive data entry and helps keep related content more consistent.

Newer post

Building Category Select Filters with autoFilter

How to output category options in an autoFilter select, submit them cleanly, and feed the resulting resource IDs into a Ditto listing.

Older post

Debugging Shopkeeper Orders That Never Reach the Mailer

A practical checklist for Shopkeeper and eForm setups where the cart works but the final order data never arrives by email.