Function __global->define_custom_field

Definitions

sources/fields.php

  • Create a custom field programmatically, or return existing if exists.This function is intended for programmers, writing upgrade scripts for a custom site (dev>staging>live).
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: int

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$name string No No required parameter N/A N/A Field name
$description string No No Blank (empty string) N/A N/A Field description
$order integer No No 0 N/A N/A Field order
$content_type string No No comcode_page N/A N/A Content type

Returns

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

Preview

Code (PHP)

/**
 * Create a custom field programmatically, or return existing if exists.This function is intended for programmers, writing upgrade scripts for a custom site (dev>staging>live).
 *
 * @param  string $name Field name
 * @param  string $description Field description
 * @param  integer $order Field order
 * @param  string $content_type Content type
 * @return AUTO_LINK Field ID
 */

function define_custom_field(string $name, string $description = '', int $order = 0, string $content_type = 'comcode_page') : int