Skip to content
Snippets Groups Projects
Commit 1f442600 authored by Kevin Kaland's avatar Kevin Kaland
Browse files

Issue #2359213: WIP define method to parse Urls.

parent 0a61e8b0
No related branches found
No related tags found
No related merge requests found
......@@ -77,7 +77,7 @@ class HandlePdfController extends ControllerBase {
}
public function populatePdf() {
$context = $this->linkManipulator->parseLink($this->requestStack->getCurrentRequest());
$context = $this->linkManipulator->parseRequest($this->requestStack->getCurrentRequest());
$config = $this->config('fillpdf.settings');
$fillpdf_service = $config->get('backend');
......
......@@ -42,7 +42,7 @@ class FillPdfAccessController implements ContainerInjectionInterface {
}
public function checkLink() {
$context = $this->linkManipulator->parseLink($this->requestStack->getCurrentRequest());
$context = $this->linkManipulator->parseRequest($this->requestStack->getCurrentRequest());
$is_admin = $this->currentUser->hasPermission('administer pdfs');
$can_publish_all = $this->currentUser->hasPermission('publish all pdfs');
......
......@@ -8,7 +8,7 @@ namespace Drupal\fillpdf;
/**
* Provides a common interface for loading and serialization of the $context
* array returned by FillPdfLinkManipulator::parseLink().
* array returned by FillPdfLinkManipulator::parseRequest().
*
* @package Drupal\fillpdf\FillPdfContextManagerInterface
*/
......
......@@ -5,13 +5,14 @@
*/
namespace Drupal\fillpdf;
use Drupal\Core\Url;
use Symfony\Component\HttpFoundation\Request;
/**
* Defines an interface to allow parsing and building FillPDF Links.
*
* A guideline for functionality is that calling generateLink on the result
* of parseLink should return a string that would parse the same way as the
* of parseRequest should return a string that would parse the same way as the
* original one.
*/
interface FillPdfLinkManipulatorInterface {
......@@ -20,10 +21,16 @@ interface FillPdfLinkManipulatorInterface {
* @param \Symfony\Component\HttpFoundation\Request $request The request
* containing the query string to parse.
* @return array
*
* @todo Should this actually take a \Drupal\Core\Url? Or should there be another method that does? What if another caller wants to parse an arbitrary URL?
*/
public function parseLink(Request $request);
public function parseRequest(Request $request);
/**
* @param \Drupal\Core\Url $link
* The valid URL containing the FillPDF generation metadata.
* e.g. http://example.com/fillpdf?entities[]=node:1&entities[]=contact:7
* @return mixed
*/
public function parseLink(Url $link);
/**
* @param array $parameters
......
......@@ -22,7 +22,7 @@ class FillPdfLinkManipulator implements FillPdfLinkManipulatorInterface {
* @todo: Maybe this should return a FillPdfLinkContext object or something?
* Guess it depends on how much I end up needing to change it.
*/
public function parseLink(Request $request) {
public function parseRequest(Request $request) {
$request_context = array(
'entity_ids' => NULL,
'fid' => NULL,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment