Chris@0: getDefinition($entity_type_id); Chris@0: if ($entity_type->get('field_ui_base_route')) { Chris@0: return new Url("entity.{$entity_type_id}.field_ui_fields", static::getRouteBundleParameter($entity_type, $bundle)); Chris@0: } Chris@0: } Chris@0: Chris@0: /** Chris@0: * Returns the next redirect path in a multipage sequence. Chris@0: * Chris@0: * @param array $destinations Chris@0: * An array of destinations to redirect to. Chris@0: * Chris@0: * @return \Drupal\Core\Url|null Chris@0: * The next destination to redirect to. Chris@0: */ Chris@0: public static function getNextDestination(array $destinations) { Chris@0: // If there are no valid destinations left, return here. Chris@0: if (empty($destinations)) { Chris@0: return NULL; Chris@0: } Chris@0: Chris@0: $next_destination = array_shift($destinations); Chris@0: if (is_array($next_destination)) { Chris@0: $next_destination['options']['query']['destinations'] = $destinations; Chris@0: $next_destination += [ Chris@0: 'route_parameters' => [], Chris@0: ]; Chris@0: $next_destination = Url::fromRoute($next_destination['route_name'], $next_destination['route_parameters'], $next_destination['options']); Chris@0: } Chris@0: else { Chris@0: $options = UrlHelper::parse($next_destination); Chris@0: if ($destinations) { Chris@0: $options['query']['destinations'] = $destinations; Chris@0: } Chris@0: // Redirect to any given path within the same domain. Chris@0: // @todo Revisit this in https://www.drupal.org/node/2418219. Chris@0: $next_destination = Url::fromUserInput('/' . $options['path'], $options); Chris@0: } Chris@0: return $next_destination; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Gets the route parameter that should be used for Field UI routes. Chris@0: * Chris@0: * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type Chris@0: * The actual entity type, not the bundle (e.g. the content entity type). Chris@0: * @param string $bundle Chris@0: * The bundle name. Chris@0: * Chris@0: * @return array Chris@0: * An array that can be used a route parameter. Chris@0: */ Chris@0: public static function getRouteBundleParameter(EntityTypeInterface $entity_type, $bundle) { Chris@0: $bundle_parameter_key = $entity_type->getBundleEntityType() ?: 'bundle'; Chris@0: return [$bundle_parameter_key => $bundle]; Chris@0: } Chris@0: Chris@0: }