Function __global->actual_add_catalogue_field

Definitions

sources/catalogues2.php

  • Add a field to the specified catalogue, without disturbing any other data in that catalogue.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: int

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$c_name ID_TEXT No No required parameter N/A N/A The codename of the catalogue the field is for
$name mixed No No required parameter N/A N/A The name of the field (either language string map or string)
$description mixed No No Blank (empty string) N/A N/A A description (either language string map or string)
$type ID_TEXT No No short_text N/A N/A The type of the field
$order ?integer No No Null N/A N/A The field order (the field order determines what order the fields are displayed within an entry) (null: next)
$defines_order BINARY No No 0 N/A N/A Whether this field defines the catalogue order
$visible BINARY No No 1 N/A N/A Whether this is a visible field
$sensitive BINARY No No 0 N/A N/A Whether this field may contain sensitive or personal data
$default LONG_TEXT No No Blank (empty string) N/A N/A The default value for the field
$required BINARY No No 0 N/A N/A Whether this field is required
$is_sortable BINARY No No 0 N/A N/A Whether the field is sortable
$include_in_main_search BINARY No No 0 N/A N/A Whether the field is included in main search
$allow_template_search BINARY No No 0 N/A N/A Whether to allow template search
$put_in_category BINARY No No 1 N/A N/A Whether the field is to be shown in category views (not applicable for the list display type)
$put_in_search BINARY No No 1 N/A N/A Whether the field is to be shown in search views (not applicable for the list display type)
$options SHORT_TEXT No No Blank (empty string) N/A N/A Field options
$id ?AUTO_LINK No No Null N/A N/A Force this ID (null: auto-increment as normal)

Returns

  • Field ID
  • Type: AUTO_LINK
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Add a field to the specified catalogue, without disturbing any other data in that catalogue.
 *
 * @param  ID_TEXT $c_name The codename of the catalogue the field is for
 * @param  mixed $name The name of the field (either language string map or string)
 * @param  mixed $description A description (either language string map or string)
 * @param  ID_TEXT $type The type of the field
 * @param  ?integer $order The field order (the field order determines what order the fields are displayed within an entry) (null: next)
 * @param  BINARY $defines_order Whether this field defines the catalogue order
 * @param  BINARY $visible Whether this is a visible field
 * @param  BINARY $sensitive Whether this field may contain sensitive or personal data
 * @param  LONG_TEXT $default The default value for the field
 * @param  BINARY $required Whether this field is required
 * @param  BINARY $is_sortable Whether the field is sortable
 * @param  BINARY $include_in_main_search Whether the field is included in main search
 * @param  BINARY $allow_template_search Whether to allow template search
 * @param  BINARY $put_in_category Whether the field is to be shown in category views (not applicable for the list display type)
 * @param  BINARY $put_in_search Whether the field is to be shown in search views (not applicable for the list display type)
 * @param  SHORT_TEXT $options Field options
 * @param  ?AUTO_LINK $id Force this ID (null: auto-increment as normal)
 * @return AUTO_LINK Field ID
 */

function actual_add_catalogue_field(string $c_name, $name, $description = '', string $type = 'short_text', ?int $order = null, int $defines_order = 0, int $visible = 1, int $sensitive = 0, string $default = '', int $required = 0, int $is_sortable = 0, int $include_in_main_search = 0, int $allow_template_search = 0, int $put_in_category = 1, int $put_in_search = 1, string $options = '', ?int $id = null) : int