Skip to content

Anatomy of an Aspect

Ian Monroe edited this page Jun 27, 2018 · 5 revisions

Regardless of what type of Aspect you are working with, they all share some common properties inherited from the base Aspect class provided by the imonroe/crps package.

Aspect properties

$aspect->aspect_type    <- (int) the $id of the AspectType which this is an instance of.
$aspect->title          <- (string) the title of this aspect.
$aspect->aspect_data    <- (string) the main data field of the aspect. Stored as longtext.
$aspect->aspect_notes   <- (string) metadata associated with this aspect. Stored as JSON-formatted text.
$aspect->aspect_source  <- (string) metadata about where this aspect came from. (e.g., API, reference, etc.)
$aspect->hidden         <- (bool) If true, aspect is not displayed.
$aspect->folded         <- (bool) If true, this aspect is folded up. If not, it's displayed normally.
$aspect->display_weight <- (int) The relative weight of the aspect, used for sorting the display.
$aspect->last_parsed    <- (datetime) The last time this aspect's `parse()` function ran successfully.
$aspect->editable       <- (bool) If true, this aspect is editable. If false, it's locked.

Aspect methods

Aspects all have some internal methods that help with casting, collections, and so forth. Many of the core methods are overridden by alternatives on their respective AspectTypes. All of them are overrideable if you need custom functionality. The most interesting ones are listed here; for a more complete picture, feel free to dig into the CRPS repos, which has all the low-level stuff in it.

$aspect->notes_schema(): JSON
$aspect->get_aspect_notes_array(): Array
$aspect->update_aspect(): void
$aspect->aspect_type(): AspectType
$aspect->notes_fields(): HTML markup
$aspect->create_form($subject_id, $aspect_type_id=null): HTML markup
$aspect->edit_form(): HTML markup
$aspect->subject_id(): int
$aspect->display_aspect(): HTML markup
$aspect->parse(): void
$aspect->pre_save(Request $request): void
$aspect->post_save(Request $request): void
$aspect->pre_update(Request $request): void
$aspect->post_update(Request $request): void
$aspect->pre_delete(Request $request): void
Clone this wiki locally