You are here

public static function SchemaActionTrait::getAllActions in Schema.org Metatag 8

Get an array of all actions, grouped by action type.

Parameters

string $flattened: Set TRUE to return a single-level array of values.

Return value

array An array of all actions. If not $flattened, the list is grouped by type.

2 calls to SchemaActionTrait::getAllActions()
SchemaActionTrait::actionForm in src/Plugin/metatag/Tag/SchemaActionTrait.php
Create the form element.
SchemaActionTrait::getActionType in src/Plugin/metatag/Tag/SchemaActionTrait.php
Get the action type for a given action.

File

src/Plugin/metatag/Tag/SchemaActionTrait.php, line 176

Class

SchemaActionTrait
Schema.org Action trait.

Namespace

Drupal\schema_metatag\Plugin\metatag\Tag

Code

public static function getAllActions($flattened = FALSE) {
  $list = $flattened ? [
    'Action',
  ] : [];
  $types = static::actionTypes();
  foreach ($types as $type) {
    if ($flattened) {
      $list = array_merge($list, static::actionObjects($type));
    }
    else {
      $list[$type] = static::actionObjects($type);
    }
  }
  return $list;
}