| lang | php |
|---|
class ExpressionEngine\Model\Status\Status
[TOC]
Related channels the status is assigned to.
Related channel entries the status is used in.
Sites the status is used in.
Roles with permissions to use the status.
Returns the value and rendered label for option select input display
| Parameter | Type | Description |
|---|---|---|
| use_ids | array |
ID of status, otherwise uses the status name. Default is false |
| Returns | array |
Array of value, and rendered label using renderTag() method. |
Renders the tag with styles using the _shared/status-tag view.
Override of the parent validateUnique to alter the language key if it is a failure. Validates true if the status is unique.
| Parameter | Type | Description |
|---|---|---|
| key | string |
Property name |
| value | string |
Property value |
| params | array |
Rule parameters |
| Returns | string |
option component array |
Saving with this model will trigger the following events:
beforeInsert
$status = ee('Model')->get('Status')->filter('status','open')->first();
// Get the Status Object.
$status = ee('Model')->get('Status')->filter('status','open')->first();
// Get entries with that status, returning the entry id to an array.
$entries_array = $status->ChannelEntries->pluck('entry_id');
// Get the Status Object.
$status = ee('Model')->get('Status')->filter('status','open')->first();
// Get the related Roles.
$roles = $status->Roles;
// Get the Members in those Roles
$members = $roles->Members->all();
// Return the usernames to an array.
$usernames = $members->pluck('username);
// As one one line:
$username_arrays = $ee('Model')
->get('Status')
->filter('status','open')
->first()
->Roles
->Members
->all()
->pluck('username');
// Get the Status Object.
$status = ee('Model')->get('Status')->filter('status','review')->first();
$status->status = 'reviewed';
// Validate and Save.
$result = $status->validate();
if ($result->isValid())
{
$status->save();
}
// Make the Status Model.
$status = ee('Model')->make('Status');
// Set the Title and Hex Color
$status->status = "MyNewStatus";
$status->highlight = '009933';
// Validate and Save.
$result = $status->validate();
if ($result->isValid())
{
$status->save();
}