Search

This is a "how do I approach this in Symphony" question, and it involves a section inheriting another sections fields while perhaps adding newer ones. Best explained with an example (this isn't real):

I have a general section called Vehicle, with an option to define the number of axles and the year manufactured. I want to create a section based on this Vehicle section, called Semi, that has an additional field providing a brief description of the goods that are being transported.

Specifically I want to do this without explicit field duplication. I could create the Vehicle section with the two fields, and then the Semi section duplicating the fields in the Vehicle section and adding new ones. Or perhaps I could use the subsection manager in some way to add additional fields by creating another section to store the fields?

The basic idea is that I need a way for a section to inherit another sections' properties; I don't just link the entries, I want to link the sections. You could do this with an extension I suppose, a new field that links just to the section and not a particular field, and when creating a new entry I could fill out the child sections data (Semi) and the parent section's data (Vehicle). Perhaps there's a better way to achieve this?

On a somewhat related note, has anyone created an extension for the selectbox field to support default values? I didn't find anything when searching.

This sounds like a use for Meta Keys. Instead of creating a Vehicle section, create your Semi section and add a Meta Keys field with default keys for Number of Axles and Year.

I understand the way you're thinking, in terms of class inheritance, but other than having to duplicate this field in each section (for each vehicle type) is there a reason you'd need a separate Vehicle section? What if you had a single "Vehciles" section, but a select box "Type" of which "Semi" was one option. And then use Meta Keys or Publish Tabs to allow for variation in the meta data for each vehicle type.

Much depends on how you want to filter your data and show it on the frontend.

The original logic was, and I was thinking abstractly, is what if I wanted to take it really far and create some kind of automotive app where it was like this, but at 10 levels deep or so, management of the fields would become a bit distressing, and the select boxes would be confusing in the long term I suspect.

I'll give meta keys a try though, because in reality what I have to do is similar but less complex. Part of this thought process comes from Model Inheritance in Rails too.

After thinking about this more, Subsection Manager is almost exactly what I want, except that the relationship I'm looking for is a 1:1 relationship, and I just don't want to select an entry to link within the subsection manager field, I'd like it to just bring the parent form inside of the child form. Maybe I can modify the subsection manager to do this.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details