/** * {@inheritdoc} */ public function alterRoutes(RouteCollection $route_collection) { $routing_path = $this->configFactory->get('headless.config')->get('routing_path'); $route_names = $route_collection->all(); foreach ($route_names as $key => $route) { // Filter Headless public routes. if (substr($key, 0, 9) === 'headless.' && $key != 'headless.config') { $old_path = $route->getPath(); $get_path = preg_replace('/^\\/(headless|' . $routing_path . ')/', '', $old_path); $new_path = '/' . $routing_path . $get_path; // Update path if changed. if ($old_path != $new_path) { $route->setPath($new_path); } } } }
/** * Returns the current status of flood control. * * @return */ protected function floodControl() { $limit = $this->configFactory->get('contact.settings')->get('flood.limit'); $interval = $this->configFactory->get('contact.settings')->get('flood.interval'); if (!$this->flood->isAllowed('contact', $limit, $interval)) { return $this->t('You cannot send more than %limit messages in @interval. Try again later.', array('%limit' => $limit, '@interval' => $this->dateFormatter->formatInterval($interval))); } return FALSE; }