Tribe__Events__Aggregator__Record__Activity::get( string $slug = null, string $action = null )
Fetches a registered Activity
Contents
Parameters
- $slug
-
(string) (Optional) (optional) The Slug of the Activity
Default value: null
- $action
-
(string) (Optional) (optional) Which action
Default value: null
Return
(null|array|object)
Source
File: src/Tribe/Aggregator/Record/Activity.php
public function get( $slug = null, $action = null ) {
if ( is_null( $slug ) ) {
return $this->items;
}
if ( ! isset( $this->map[ $slug ] ) ) {
return null;
}
// Map the Slug
$slug = $this->map[ $slug ];
// Check if it actually exists
if ( empty( $this->items[ $slug ] ) ) {
return null;
}
$actions = $this->items[ $slug ];
// If we trying to get a specific action and
if ( is_null( $action ) ) {
return $this->items[ $slug ];
} elseif ( ! empty( $actions->{ $action } ) ) {
return $actions->{ $action };
} else {
return null;
}
}