Loading gantt.info.yml +0 −2 Original line number Diff line number Diff line Loading @@ -3,5 +3,3 @@ type: module description: This module uses the dhtmlx GANTT javascript library package: Views core_version_requirement: ^9 || ^10 dependencies: - views:views src/Controller/GanttController.php +23 −3 Original line number Diff line number Diff line Loading @@ -7,6 +7,9 @@ use Drupal\Core\Datetime\Entity\DateFormat; use Drupal\paragraphs\Entity\Paragraph; use Symfony\Component\HttpFoundation\JsonResponse; use Drupal\views\Views; use Drupal\Core\DependencyInjection\ContainerInjectionInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\RequestStack; /** * Returns responses for Gantt routes. Loading @@ -28,13 +31,30 @@ class GanttController extends ControllerBase { */ private $get = []; /** * {@inheritDoc} * * @var Drupal\Core\Datetime\Entity\DateFormat; */ private $dateFormat; /** * {@inheritDoc} */ public function __construct() { $request = \Drupal::request(); public function __construct(RequestStack $request, DateFormat $dateFormat) { $this->post = $request->request->all(); $this->get = $request->query->all(); $this->dateFormat = $dateFormat; } /** * {@inheritdoc} */ public static function create(ContainerInterface $container) { return new static( $container->get('request_stack'), $container->get('date.formatter') ); } /** Loading Loading @@ -135,7 +155,7 @@ class GanttController extends ControllerBase { * Convert date return with format Y-m-d. */ protected function formatDate($date, $type = 'date', $format = 'Y-m-d H:i:s') { $drupalShortFormat = DateFormat::load('short')->getPattern(); $drupalShortFormat = $this->dateFormat->load('short')->getPattern(); if ($type == 'date') { $format = current(explode(' ', $format)); $drupalShortFormat = current(explode(' ', $drupalShortFormat)); Loading Loading
gantt.info.yml +0 −2 Original line number Diff line number Diff line Loading @@ -3,5 +3,3 @@ type: module description: This module uses the dhtmlx GANTT javascript library package: Views core_version_requirement: ^9 || ^10 dependencies: - views:views
src/Controller/GanttController.php +23 −3 Original line number Diff line number Diff line Loading @@ -7,6 +7,9 @@ use Drupal\Core\Datetime\Entity\DateFormat; use Drupal\paragraphs\Entity\Paragraph; use Symfony\Component\HttpFoundation\JsonResponse; use Drupal\views\Views; use Drupal\Core\DependencyInjection\ContainerInjectionInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\RequestStack; /** * Returns responses for Gantt routes. Loading @@ -28,13 +31,30 @@ class GanttController extends ControllerBase { */ private $get = []; /** * {@inheritDoc} * * @var Drupal\Core\Datetime\Entity\DateFormat; */ private $dateFormat; /** * {@inheritDoc} */ public function __construct() { $request = \Drupal::request(); public function __construct(RequestStack $request, DateFormat $dateFormat) { $this->post = $request->request->all(); $this->get = $request->query->all(); $this->dateFormat = $dateFormat; } /** * {@inheritdoc} */ public static function create(ContainerInterface $container) { return new static( $container->get('request_stack'), $container->get('date.formatter') ); } /** Loading Loading @@ -135,7 +155,7 @@ class GanttController extends ControllerBase { * Convert date return with format Y-m-d. */ protected function formatDate($date, $type = 'date', $format = 'Y-m-d H:i:s') { $drupalShortFormat = DateFormat::load('short')->getPattern(); $drupalShortFormat = $this->dateFormat->load('short')->getPattern(); if ($type == 'date') { $format = current(explode(' ', $format)); $drupalShortFormat = current(explode(' ', $drupalShortFormat)); Loading