Invision Power Services, Inc. * @copyright (c) Invision Power Services, Inc. * @license https://www.invisioncommunity.com/legal/standards/ {subpackage} * @since {date} */ namespace IPS\{app}\extensions\core\CustomField; /* To prevent PHP errors (extending class does not exist) revealing path */ use IPS\CustomField; use IPS\Extensions\CustomFieldAbstract; use IPS\Helpers\Form; if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) ) { header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' ); exit; } /** * CustomField Extension */ class {class} extends CustomFieldAbstract { /** * The value that will be used for the "field type" * This must be unique * * @return string */ public static function fieldType() : string { return ''; } /** * Language string for the title of the field type. * Will be displayed in the "Field Type" dropdown list when * creating a custom field * * @return string */ public static function fieldTypeTitle() : string { return ''; } /** * The class that should be called to render the field * in a form. This class should extend FormAbstract (or an existing field) * @see CustomField::buildHelper() * * @return string */ public static function formClass() : string { return ''; } /** * Can be overridden by individual extension implementations * to allow for a field to be available only in certain connditions * * @return bool */ public static function isEnabled() : bool { return true; } /** * A list of form elements that will be toggled on when this field * type is selected * @see CustomField::$additionalFieldToggles * * @return array */ public static function fieldTypeToggles() : array { return []; } /** * Add fields to the field creation form * * @param Form $form * @param CustomField $field The field currently being modified * @return void */ public static function form( Form $form, CustomField $field ) : void { } /** * Process values from the ACP Custom Field form * * @param array $values * @return array */ public static function formatFormValues( array $values ) : array { return $values; } /** * Display Value * @see CustomField::displayValue() * * @param CustomField $field * @param mixed|null $value The value * @param bool $showSensitiveInformation If TRUE, potentially sensitive data (like passwords) will be displayed - otherwise will be blanked out * @param string|null $separator Used to separate items when displaying a field with multiple values. * @return string|null */ public static function displayValue( CustomField $field, mixed $value=NULL, bool $showSensitiveInformation=FALSE, string $separator=NULL ): ?string { return $value; } }