Loading src/Routing/PriceSpiderRoutes.php +31 −2 Original line number Diff line number Diff line Loading @@ -2,12 +2,41 @@ namespace Drupal\pricespider\Routing; use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\DependencyInjection\ContainerInjectionInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\Routing\Route; /** * Class PriceSpiderRoutes. */ class PriceSpiderRoutes { class PriceSpiderRoutes implements ContainerInjectionInterface { /** * The Drupal Config Factory. * * @var \Drupal\Core\Config\ConfigFactoryInterface */ protected $configFactory; /** * Constructs a new PriceSpiderRoutes object. * * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory * Drupal config factory. */ public function __construct(ConfigFactoryInterface $config_factory) { $this->configFactory = $config_factory; } /** * {@inheritdoc} */ public static function create(ContainerInterface $container) { return new static( $container->get('config.factory') ); } /** * Returns an array of route objects. Loading @@ -19,7 +48,7 @@ class PriceSpiderRoutes { $routes = []; // Have a uri for the Where to buy page? if ($wtb_uri = \Drupal::config('pricespider.settings')->get('wtb.uri')) { if ($wtb_uri = $this->configFactory->get('pricespider.settings')->get('wtb.uri')) { $routes['pricespider.wtb'] = new Route( // Path to attach route to. $wtb_uri, Loading Loading
src/Routing/PriceSpiderRoutes.php +31 −2 Original line number Diff line number Diff line Loading @@ -2,12 +2,41 @@ namespace Drupal\pricespider\Routing; use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\DependencyInjection\ContainerInjectionInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\Routing\Route; /** * Class PriceSpiderRoutes. */ class PriceSpiderRoutes { class PriceSpiderRoutes implements ContainerInjectionInterface { /** * The Drupal Config Factory. * * @var \Drupal\Core\Config\ConfigFactoryInterface */ protected $configFactory; /** * Constructs a new PriceSpiderRoutes object. * * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory * Drupal config factory. */ public function __construct(ConfigFactoryInterface $config_factory) { $this->configFactory = $config_factory; } /** * {@inheritdoc} */ public static function create(ContainerInterface $container) { return new static( $container->get('config.factory') ); } /** * Returns an array of route objects. Loading @@ -19,7 +48,7 @@ class PriceSpiderRoutes { $routes = []; // Have a uri for the Where to buy page? if ($wtb_uri = \Drupal::config('pricespider.settings')->get('wtb.uri')) { if ($wtb_uri = $this->configFactory->get('pricespider.settings')->get('wtb.uri')) { $routes['pricespider.wtb'] = new Route( // Path to attach route to. $wtb_uri, Loading