Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
LLMS_REST_Fields::register_fields_for_certificates()
Register fields for template and earned certificates.
Return Return
(void)
Source Source
File: includes/class-llms-rest-fields.php
private function register_fields_for_certificates() { foreach ( $this->get_fields_for_certificates() as $key => $schema ) { $schema['context'] = array( 'view', 'edit' ); register_rest_field( array( 'llms_certificate', 'llms_my_certificate' ), "certificate_{$key}", array( 'schema' => $schema, 'get_callback' => function( $object ) use ( $key ) { $cert = llms_get_certificate( $object['id'], true ); $func = "get_{$key}"; return $cert ? $cert->$func() : null; }, 'update_callback' => function( $value, $post ) use ( $key ) { $cert = llms_get_certificate( $post->ID, true ); return $cert ? $cert->set( $key, $value ) : null; }, ) ); } }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
6.0.0 | Introduced. |