FieldGroupConverter.php in Field Group 8.3
File
src/Routing/FieldGroupConverter.php
View source
<?php
namespace Drupal\field_group\Routing;
use Symfony\Component\Routing\Route;
use Drupal\Core\ParamConverter\ParamConverterInterface;
class FieldGroupConverter implements ParamConverterInterface {
public function applies($definition, $name, Route $route) {
return isset($definition['type']) && $definition['type'] == 'field_group';
}
public function convert($value, $definition, $name, array $defaults) {
$identifiers = explode('.', $value);
if (count($identifiers) != 5) {
return;
}
return field_group_load_field_group($identifiers[4], $identifiers[0], $identifiers[1], $identifiers[2], $identifiers[3]);
}
}