Organization
You may access the following public properties and methods on an Organization Element.
# Public Properties
All of the standard Element (opens new window) public properties are available plus the following:
Property | Type | Description |
---|---|---|
state | string (opens new window), null (opens new window) | The organization's state (custom defined) |
dateJoined | DateTime (opens new window), null (opens new window) | The date the organization joined |
# Public Methods
All of the standard Element (opens new window) public methods are available plus the following:
# getUsers( $criteria = [] )
Returns: User Query (opens new window)
Argument | Accepts | Description |
---|---|---|
$criteria | array (opens new window) | User Query (opens new window) criteria |
::: code
{# Get an Organization Type #}
{% set element = craft.organizations.elements.find('flipbox') %}
{% set users = element.getUsers({status: null}).all() %}
<ul>
{% for user in users %}
<li>{{ user.id }} - {{ user.getFullName() }}</li>
{% endfor %}
</ul>
use flipbox\organizations\Organizations;
$element = Organizations::getInstance()->getOrganizations()->get([
'slug' => 'flipbox'
]);
$users = $element->getUsers([
'status' => null
]);
foreach ($users as $user) {
// $user is a /craft/elements/User
}
:::
# getTypes( $criteria = [] )
Returns: Organization Type Query
Argument | Accepts | Description |
---|---|---|
$criteria | array (opens new window) | Organization Type Query criteria |
::: code
{# Get an Organization Type #}
{% set element = craft.organizations.elements.find('flipbox') %}
{% set users = element.getTypes({status: null}).all() %}
<ul>
{% for type in types %}
<li>{{ type.id }} - {{ type.name }}</li>
{% endfor %}
</ul>
use flipbox\organizations\Organizations;
$element = Organizations::getInstance()->getOrganizations()->get([
'slug' => 'flipbox'
]);
$types = $element->getTypes([
'status' => null
]);
foreach ($types as $type) {
// $type is a /flipbox/organizations/records/OrganizationType
}
:::
# getType( $identifier )
Returns: Organization Type, null (opens new window)
Argument | Accepts | Description |
---|---|---|
$identifier | string (opens new window), integer (opens new window), null (opens new window) | Organization Type criteria |
::: code
{# Get an Organization Type #}
{% set element = craft.organizations.elements.find('flipbox') %}
{% set type = element.getType('technology') %}
<p>{{ type.id }} - <strong>{{ type.name }}</strong></p>
use flipbox\organizations\Organizations;
$element = Organizations::getInstance()->getOrganizations()->get([
'slug' => 'flipbox'
]);
/** @var /flipbox/organizations/records/OrganizationType $type */
$type = $element->getType('technology');
:::
# getPrimaryType()
Returns: Organization Type, null (opens new window)
::: code
{# Get an Organization Type #}
{% set element = craft.organizations.elements.find('flipbox') %}
{% set type = element.getPrimaryType() %}
<p>{{ type.id }} - <strong>{{ type.name }}</strong></p>
use flipbox\organizations\Organizations;
$element = Organizations::getInstance()->getOrganizations()->get([
'slug' => 'flipbox'
]);
/** @var /flipbox/organizations/records/OrganizationType $type */
$type = $element->getPrimaryType();
:::
# getActiveType()
Returns: Organization Type, null (opens new window)
::: code
{# Get an Organization Type #}
{% set element = craft.organizations.elements.find('flipbox') %}
{% set type = element.getActiveType() %}
<p>{{ type.id }} - <strong>{{ type.name }}</strong></p>
use flipbox\organizations\Organizations;
$element = Organizations::getInstance()->getOrganizations()->get([
'slug' => 'flipbox'
]);
/** @var /flipbox/organizations/records/OrganizationType $type */
$type = $element->getActiveType();
:::