LLMS_REST_Controller_Stubs::get_object_id( obj $object )
Retrieve an ID from the object
Parameters Parameters
- $object
-
(obj) (Required) Item object.
Return Return
(int)
Source Source
File: libraries/lifterlms-rest/includes/abstracts/class-llms-rest-controller-stubs.php
protected function get_object_id( $object ) {
if ( is_object( $object ) && ! empty( $object->id ) ) {
return $object->id;
} elseif ( is_array( $object ) && ! empty( $object['id'] ) ) {
return $object['id'];
} elseif ( method_exists( $object, 'get_id' ) ) {
return $object->get_id();
} elseif ( method_exists( $object, 'get' ) ) {
return $object->get( 'id' );
}
// @todo: add version to message.
// Translators: %s = method name.
_doing_it_wrong( 'LLMS_REST_Controller::get_object_id', sprintf( __( "Method '%s' must be overridden.", 'lifterlms' ), __METHOD__ ), '1.0.0-beta.1' );
// For example.
return 0;
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 1.0.0-beta.1 | Introduced. |