FieldUI.php in Drupal 9
File
core/modules/field_ui/src/FieldUI.php
View source
<?php
namespace Drupal\field_ui;
use Drupal\Component\Utility\UrlHelper;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Url;
class FieldUI {
public static function getOverviewRouteInfo($entity_type_id, $bundle) {
$entity_type = \Drupal::entityTypeManager()
->getDefinition($entity_type_id);
if ($entity_type
->get('field_ui_base_route')) {
return new Url("entity.{$entity_type_id}.field_ui_fields", static::getRouteBundleParameter($entity_type, $bundle));
}
}
public static function getNextDestination(array $destinations) {
if (empty($destinations)) {
return NULL;
}
$next_destination = array_shift($destinations);
if (is_array($next_destination)) {
$next_destination['options']['query']['destinations'] = $destinations;
$next_destination += [
'route_parameters' => [],
];
$next_destination = Url::fromRoute($next_destination['route_name'], $next_destination['route_parameters'], $next_destination['options']);
}
else {
$options = UrlHelper::parse($next_destination);
if ($destinations) {
$options['query']['destinations'] = $destinations;
}
$next_destination = Url::fromUserInput('/' . $options['path'], $options);
}
return $next_destination;
}
public static function getRouteBundleParameter(EntityTypeInterface $entity_type, $bundle) {
$bundle_parameter_key = $entity_type
->getBundleEntityType() ?: 'bundle';
return [
$bundle_parameter_key => $bundle,
];
}
}
Classes
Name |
Description |
FieldUI |
Static service container wrapper for Field UI. |