You are here

public static function SchemaUrl::fromOptions in Schemata 8

Build a URI to a schema resource.

Parameters

string $format: The format or type of schema.

string $describes: The format being described.

string $entity_type_id: The entity type.

string $bundle: The entity bundle.

Return value

\Drupal\Core\Url The schema resource Url object.

1 call to SchemaUrl::fromOptions()
SchemaUrl::fromSchema in src/SchemaUrl.php
Generate a URI for the Schema instance.

File

src/SchemaUrl.php, line 54

Class

SchemaUrl
Provides additional URL factory methods for linking to Schema.

Namespace

Drupal\schemata

Code

public static function fromOptions($format, $describes, $entity_type_id, $bundle = NULL) {
  $route_name = empty($bundle) ? sprintf('schemata.%s', $entity_type_id) : sprintf('schemata.%s:%s', $entity_type_id, $bundle);
  return Url::fromRoute($route_name, [], [
    'query' => [
      '_format' => $format,
      '_describes' => $describes,
    ],
    'absolute' => TRUE,
  ]);
}