Search

A new extension, "Meta Keys" is now available for download. Comments and feedback can be left here but if you discover any issues, please post it on the issue tracker.

And the README:

Meta Keys

The Meta Keys field allows you to add arbitrary pieces of information to entries identified by a user generated key. You can set default keys, and choose different output types by key or named key. It attempts to provide some handy filtering hooks for your datasources as well.

Meta Keys Field Interface

INSTALLATION

  1. Upload the 'field_metakeys' folder in this archive to your Symphony 'extensions' folder.
  2. Enable it by selecting the "Field: Meta Keys", choose Enable from the with-selected menu, then click Apply.
  3. You can now add the "Meta Keys" field to your Sections.

OPTIONS

Section

Meta Keys Section Editor

Default Keys

You can set a number of default keys in the Section Editor, these will appear when you first create an entry. You don't have to use them, they can be removed with the [x].

Validator

The usual Symphony validation applies to the Values of your Keys.

Required Field

This makes sure that you have at least one completed Pair, that is, the Key and Value is filled.

Datasources

Named Keys vs. Keys

You can choose between the named keys output, or just a generic key output for your XML. A named key will use the name of the key as the node name, whereas generic will just list each pair under a 'key' node.

Meta Keys Output XML

Filtering

Best efforts have been made for these to support normal Symphony enumerators of +,, and :, but please report any unusual behaviour!

colour

Normal default filtering without any *: conditions will search on keys. This will return all the entries where a key of colour exists (whether it has a value or not).

value: red

This will return all entries where one Pair exists that has the value of red.

key-equals: colour=red

This will return all entries where the Colour key equals red. You can chain this as well with key-equals: colour=red, shape=square that will get all entries where the Colour is red and the Shape is square.

XMLImporter support

Since the 0.9.5 release, this Field now integrates with XMLImporter. It expects a comma delimited string, eg. red, square. This will populate the first key with red and the second key with square.

If there are default keys, these will be prefilled first. So if the Default Keys for my Meta Keys field were Colour, Shape, the previous string would result in Colour: red, Shape: square. If the string contained more values than keys, additional keys are named as Key $i, where is $i is the index. So red, square, $10.00 would result in Colour: red, Shape: square, Key 3: $10.00.

CHANGE LOG

0.9.5 (22nd November 2011)

  • Add prepareImportValue function for the XMLImporter

0.9.4 (27th September 2011)

  • Explicitly state UTF-8 for tables (thanks @kanduvisla)
  • Fix bug when deleting empty keys (thanks @kanduvisla)

0.9.3 (9th March 2011)

  • Cleanup of extension for S2.2
  • Added Romanian translation (thanks Vlad)

0.9.2 (15th December 2010)

  • Fix output error when only one key/value pair was added

0.9.1 (10th November 2010)

  • Few CSS Tweaks to make Meta Keys play better with other fields
  • Fix Safari autofocus bug

0.9 (11th October 2010)

  • Initial Public Release
Attachments:
metakeys_output_xml.png, metakeys_field_interface.png and metakeys_section_editor.png

@brendo, very cool.

Would you mind sharing with us an example on how you use this extension?

An example I thought of would be an e-commerce store where all Products have a varied set of information.

Most might have a Size & Colour, so I could set them as Default Keys, but then depending on the product they might then have a Weight or Dimensions.

Instead of just having creating multiple fields for each of the ‘possible’ keys, this extension allows you to just define what you need for that entry.

Admittedly, it does break the Symphony flow a bit, because there would be nothing stopping someone from using this field soley to hold all entry data instead of creating multiple fields, but I still think it has it’s uses and would come in handy :)

Definitely something that would be useful!

We recently built a service where authors are able to choose the skin for their personal page. A textarea with json encoded data was used as it was simple and straightforward, but we might seriously consider switching to Meta Keys because it seems the perfect fit. Thanks :)

Great idea, brendo!

This is really interesting, Brendan! Implementing a faceted classification is going to be a lot easier :)

I'm trying to use this extension to allow an arbitrary "credits" field on a video portfolio. The credits are arbitrary, so this field would be the perfect solution. However, I get a fatal database error when trying to save an entry with a Meta Keys field. See below (I changed the key/value names to generic ones for privacy):

Unknown column 'sortorder' in 'field list'

An error occurred while attempting to execute the following query

INSERT INTO sym_entries_data_11 (entry_id, key_handle, key_value, value_handle, value_value, sortorder) VALUES ('2', 'director', 'Director', 'joe-chang', 'Joe Chang', '1')

I've also reported this issue to the tracker. Any insight?

Apologies, I was looking at making the keys sortable on the backend and that must of slipped through the cracks when I reverted it.

Pull from master, it’s been fixed :)

Haha, bad extension-adding timing for the win!

Thanks brendo!

Meta Keys updated to version 0.9.1 on 10th of November 2010

  • Few CSS Tweaks to make Meta Keys play better with other fields (Meta Keys inside a Subsection Manager, Meta Keys following a Meta Keys field etc.)
  • Fix Safari autofocus bug (Extension Issue #1)

Wow, this looks great brendo.

I have been running into this issue building shops which need products with variable details, thanks a lot.

Meta Keys updated to version 0.9.2 on 15th of December 2010

  • Fix output error when only one key/value pair was added

Meta Keys updated to version 0.9.3 on 9th of March 2011

  • Cleanup of extension for S2.2
  • Added Romanian translation (thanks Vlad)

Hi Brendo,

I sent you a pull request which fixes/adds the following:

  • It fixes the bug where empty key/values would not be deleted if at least one key/value wasn't empty.
  • It adds an extra option to the section editor to make the automatic deletion of empty key/values optional.

Meta Keys updated to version 0.9.4 on 27th of September 2011

0.9.4 (27th September 2011)

  • Explicitly state UTF-8 for tables (thanks @kanduvisla)
  • Fix bug when deleting empty keys (thanks @kanduvisla)

Meta Keys updated to version 0.9.5 on 22nd of November 2011

0.9.5 (22nd November 2011)

  • Add prepareImportValue function for the XMLImporter

Hi

I am getting some unexpected behaviour when trying to chain filters together. I am trying to do:

manufacturer=bosch AND bulb-shape=round

when I do :

key-equals: manufacturer=bosch, bulb-shape=round

I get results with manufacturer=bosch OR bulb-shape=round

I get the same results for:

key-equals: manufacturer=bosch + bulb-shape=round

Am I doing something wrong?

Am I doing something wrong?

Not really, I've never tested for chaining filters so I'm unsure of if it's supported or not.

You could try key-equals: manufacturer=bosch + key-equals: bulb-shape=round, but if that doesn't work can you add it as an issue to Github and I'll have a closer look into it :)

Meta Keys updated to version 1.0 on 7th of June 2012

Any way to import entries with key and value using XML Importer ?

I mean not using default keys, but something like

<entry>
 <key>key1</key>
 <value>value1</value>
</entry>
<entry>
 <key>key2</key>
 <value>value2</value>
</entry>

I need to set the key name so I can filter things and compare entries.

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