class DevelGenerateRoutes

Same name in other branches
  1. 4.x devel_generate/src/Routing/DevelGenerateRoutes.php \Drupal\devel_generate\Routing\DevelGenerateRoutes
  2. 5.x devel_generate/src/Routing/DevelGenerateRoutes.php \Drupal\devel_generate\Routing\DevelGenerateRoutes

Provides dynamic routes for devel_generate.

Hierarchy

  • class \Drupal\devel_generate\Routing\DevelGenerateRoutes implements \Drupal\Core\DependencyInjection\ContainerInjectionInterface

Expanded class hierarchy of DevelGenerateRoutes

File

devel_generate/src/Routing/DevelGenerateRoutes.php, line 13

Namespace

Drupal\devel_generate\Routing
View source
class DevelGenerateRoutes implements ContainerInjectionInterface {
    
    /**
     * Constructs a new devel_generate route subscriber.
     *
     * @param \Drupal\Component\Plugin\PluginManagerInterface $devel_generate_manager
     *   The DevelGeneratePluginManager.
     */
    public function __construct(PluginManagerInterface $devel_generate_manager) {
        $this->DevelGenerateManager = $devel_generate_manager;
    }
    
    /**
     * {@inheritdoc}
     */
    public static function create(ContainerInterface $container) {
        return new static($container->get('plugin.manager.develgenerate'));
    }
    public function routes() {
        $devel_generate_plugins = $this->DevelGenerateManager
            ->getDefinitions();
        $routes = array();
        foreach ($devel_generate_plugins as $id => $plugin) {
            $label = $plugin['label'];
            $type_url_str = str_replace('_', '-', $plugin['url']);
            $routes["devel_generate.{$id}"] = new Route("admin/config/development/generate/{$type_url_str}", array(
                '_form' => '\\Drupal\\devel_generate\\Form\\DevelGenerateForm',
                '_title' => "Generate {$label}",
                '_plugin_id' => $id,
            ), array(
                '_permission' => $plugin['permission'],
            ));
        }
        return $routes;
    }

}

Members

Title Sort descending Modifiers Object type Summary
DevelGenerateRoutes::create public static function
DevelGenerateRoutes::routes public function
DevelGenerateRoutes::__construct public function Constructs a new devel_generate route subscriber.