Search

I have a simple Select Box field with some pre-defined values (one, two, three), say 'tags'. Authors can add one or more of these 'tag' values to an entry.

What I'd like to have is an option to list the possible values on the front-end. So I need to have a DS that fetches all these predefined value options.

I could query all entries and filter them on distinct 'tag' values, but that seems a lot of work. Is there some way where I can create a simple custom DS that simply fetches my predefined value options for this field?

I haven't used it myself but I believe that's what the Section Schemas extension does.

Thanks Nils: you're right. I remember looking into that extension before. I was hoping it would be easier with a simple custom DS.

Here's a quick solution for a custom ds:

  1. Create a datasource.
  2. Open the datasource file.
  3. Change function allowEditorToParse to return false instead of true.
  4. Find out the field id of the select box you're interested in.
  5. Add public $fieldId = 19; (where 19 is the id) just below all the other properties at the top of the class.
  6. Replace the grab function with this one.

Hopefully, it will work.

Oooh @Alpacaaa that's exactly what I was looking for. Works a charm (I had to change the table_ prefix to sym_)!

Thanks a bazillion!

Awesome! Changing table prefix shouldn't be needed. It doesn't work using table_??

Nope, it had sym_fields_select but my table was called sym_fields_select.

That's true but symphony automatically replace table_ with the correct prefix you chose during install. Nothing important though, just to clarify :)

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