item_interface
interface item_interface implements entity_interface
Public-facing read-only representation of an Item.
This contract intentionally hides mutator methods (with_* or setters)
to prevent extensions from coupling to internal entity behavior.
Extensions must interact with items only through this interface for reading state.
Constants
| TYPE |
Default logical type identifier for fallback items. |
Methods
Get the logical type identifier of the item.
Get the Moodle context ID associated with the item.
Get the course ID tied to the item.
Get the author or owner user ID.
Get the parent item ID when hierarchical.
Get the full display name.
Get the abbreviated display name.
Get the idnumber field (external identifier).
Get the item description text.
Returns the Moodle format constant (e.g., FORMAT_HTML).
Get the current status identifier.
Get the raw visibility flag.
Domain-level visibility check.
Get the GUID reference if present.
Get the sort order value.
Get the semantic version string if tracked.
Get creation timestamp.
Get last modification timestamp.
Get user ID of last modifier.
Retrieve a specific metadata value.
Check if a metadata key exists.
Get all metadata as an associative array.
Details
in
entity_interface at line 38
int|null
get_id()
Get the entity unique identifier.
Returns null if the entity has not been persisted yet.
in
entity_interface at line 46
array
to_array()
Convert the entity state to a plain associative array.
Useful for DTO conversion, logging, or debugging.
at line 37
string
get_type()
Get the logical type identifier of the item.
at line 42
int|null
get_contextid()
Get the Moodle context ID associated with the item.
at line 47
int|null
get_courseid()
Get the course ID tied to the item.
at line 52
int|null
get_userid()
Get the author or owner user ID.
at line 57
int|null
get_parent()
Get the parent item ID when hierarchical.
at line 62
string|null
get_fullname()
Get the full display name.
at line 67
string|null
get_shortname()
Get the abbreviated display name.
at line 72
string|null
get_idnumber()
Get the idnumber field (external identifier).
at line 77
string|null
get_description()
Get the item description text.
at line 82
int
get_descriptionformat()
Returns the Moodle format constant (e.g., FORMAT_HTML).
at line 87
string
get_status()
Get the current status identifier.
at line 92
int
get_visible()
Get the raw visibility flag.
at line 97
bool
is_visible()
Domain-level visibility check.
at line 102
string|null
get_guid()
Get the GUID reference if present.
at line 107
int
get_sortorder()
Get the sort order value.
at line 112
string|null
get_version()
Get the semantic version string if tracked.
at line 117
int
get_timecreated()
Get creation timestamp.
at line 122
int
get_timemodified()
Get last modification timestamp.
at line 127
int|null
get_usermodified()
Get user ID of last modifier.
at line 139
mixed
get_meta(string $key, mixed $default = null)
Retrieve a specific metadata value.
at line 148
bool
has_meta(string $key)
Check if a metadata key exists.
at line 155
array
get_all_meta()
Get all metadata as an associative array.