You are here

public function ColorsSettingsForm::getEntityFromRoute in Colors 8

1 call to ColorsSettingsForm::getEntityFromRoute()
ColorsSettingsForm::buildForm in src/Form/ColorsSettingsForm.php
Form constructor.

File

src/Form/ColorsSettingsForm.php, line 336

Class

ColorsSettingsForm
Configure color settings.

Namespace

Drupal\colors\Form

Code

public function getEntityFromRoute($route) {
  $part = '';
  $route_name = $route
    ->getRouteName();
  if ($route_name === 'colors.ui_settings_entity.users') {
    $part .= 'user_current';
  }
  elseif ($route_name !== 'colors.ui_settings') {
    $parts = explode('/', $route
      ->getRouteObject()
      ->getPath());
    $part .= end($parts);
  }
  return $part;
}