Functions

Append fields to content add/edit form for gathering custom fields.

append_form_custom_fields(\ID_TEXT $content_type, \?ID_TEXT $id, \Tempcode $fields, \Tempcode $hidden, \?array $field_filter = null, boolean $field_filter_whitelist = true, boolean $add_separate_header = false
package core_fields

Parameters

$content_type

\ID_TEXT

Content type hook codename

$id

\?ID_TEXT

Content entry ID (null: new entry)

$fields

\Tempcode

Fields (passed by reference)

$hidden

\Tempcode

Hidden Fields (passed by reference)

$field_filter

\?array

Limit fields to a set (null: no limit)

$field_filter_whitelist

boolean

Whether $field_filter is a whitelist (if false, it is a blacklist)

$add_separate_header

boolean

Whether to add a separate header above the fields, so long as not all the fields are already under some other header

Farm out the files for catalogue entry fields.

catalogue_file_script() 
package core_fields

Get a list of all field types to choose from.

create_selection_list_field_type(\ID_TEXT $type = '', boolean $limit_to_storage_set = false) : \Tempcode
package core_fields

Parameters

$type

\ID_TEXT

Field type to select

$limit_to_storage_set

boolean

Whether to only show options in the same storage set as $type

Returns

\TempcodeList of field types

Delete custom fields for content item.

delete_form_custom_fields(\ID_TEXT $content_type, \ID_TEXT $id) 
package core_fields

Parameters

$content_type

\ID_TEXT

Content type hook codename

$id

\ID_TEXT

Content entry ID

Get catalogue entry ID bound to a content entry.

get_bound_content_entry(\ID_TEXT $content_type, \ID_TEXT $id) : \?AUTO_LINK
package core_fields

Parameters

$content_type

\ID_TEXT

Content type hook codename

$id

\ID_TEXT

Content entry ID

Returns

\?AUTO_LINKBound catalogue entry ID (null: none)

Ensure a catalogues fields are loaded up in a cache, and return them.

get_catalogue_fields(\?ID_TEXT $catalogue_name = null) : array
package core_fields

Parameters

$catalogue_name

\?ID_TEXT

The name of the catalogue (null: all catalogues)

Returns

arrayThe fields (empty array if the catalogue does not exist)

Get a fields hook, from a given codename.

get_fields_hook(\ID_TEXT $type) : object
package core_fields

Parameters

$type

\ID_TEXT

Codename

Returns

objectHook object

Find whether a content type has a tied catalogue.

has_tied_catalogue(\ID_TEXT $content_type) : boolean
package core_fields

Parameters

$content_type

\ID_TEXT

Content type hook codename

Returns

booleanWhether it has

Get extra entry point data for managing custom fields for a content type.

manage_custom_fields_entry_points(\ID_TEXT $content_type) : array
package core_fields

Parameters

$content_type

\ID_TEXT

Content type hook codename

Returns

arrayExtra get_entry_points data

Parse field options into a setting map and return a specific value from it.

option_value_from_field_array(array $field, string $name, string $default = '') : string
package core_fields

Parameters

$field

array

Field map

$name

string

Field name

$default

string

Field default value

Returns

stringThe value

Parse a field options string into a setting map.

parse_field_options(string $__options) : array
package core_fields

Parameters

$__options

string

Options string

Returns

arrayThe setting map

Save custom fields to a content item.

save_form_custom_fields(\ID_TEXT $content_type, \ID_TEXT $id, \?ID_TEXT $old_id = null
package core_fields

Parameters

$content_type

\ID_TEXT

Content type hook codename

$id

\ID_TEXT

Content entry ID

$old_id

\?ID_TEXT

Content entry ID (prior to possible rename) (null: definitely unchanged)