List field - gobezu/k2fields GitHub Wiki

#List field type

List field type is mapped against the table #__k2_extra_fields_list_values in which you would need to import all lists, data sets, to be used. Lists are identified by the numeric column list.

In order to ease the data maintenance there is an import facility to get data into the table.

##Importing data from files

You will need to save your data to a file called k2fields_list_import.csv and locate it under your SITE\tmp folder. Please do use this file (unzip before use) as reference on how to create such file (data of the file is taken from wikipedia).

Sample excerpt of the file:

113%%%%Africa
113%%infile:Africa%%Algeria (Al - Jaza'ir)
113%%infile:Africa%%Abyssinia - Gondar

Explaining each piece of the file:

  • %% is the column delimiter and the file has 3 columns namely list ID, parent of the value and the value itself
  • list ID is the arbitrary, preferably sequential, integer value designated by you for each list you create
  • parent of the value can be empty if the value to be imported on that row doesn't have any parent or is the top most in the hierarchy of values
    • If parent was earlier inserted and this is an update import of the list then you can use the node by looking it up in the table and provide the node value in this column.
    • Again if parent was earlier imported and this is an update import of the list and if you don't want to bother looking up the node value you can simply provide the value prefixed by value:
    • If parent is new and is included in the current import file then you can refer to the parent by calling the parent values and prefixing it by infile:
  • the last column in this file is the actual value to be imported