Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update: get public url from provider #45

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update: add node interface to getPublicUrl method
  • Loading branch information
davidspiola committed Nov 5, 2023
commit e0bb65ddca588ee3a1197ab10e7bae1e02c8be1e
9 changes: 7 additions & 2 deletions Classes/Eel/Mautic.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Garagist\Mautic\Eel;

use Neos\ContentRepository\Domain\Model\NodeInterface;
use Neos\Flow\Annotations as Flow;
use Garagist\Mautic\Provider\DataProviderInterface;
use Neos\Eel\ProtectedContextAwareInterface;
Expand All @@ -14,9 +15,13 @@ class Mautic implements ProtectedContextAwareInterface
*/
protected $data;

public function getPublicUrl(): string
/**
* @param NodeInterface $node
* @return string
*/
public function getPublicUrl(NodeInterface $node): string
{
return $this->data->getPublicUrl();
return $this->data->getPublicUrl($node);
}

/**
Expand Down
6 changes: 5 additions & 1 deletion Classes/Provider/DataProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,11 @@ protected function filterHiddenSegments(array $segments): array
});
}

public function getPublicUrl(): string
/**
* @param NodeInterface $node
* @return string
*/
public function getPublicUrl(NodeInterface $node): string
{
return $this->settings['publicUrl'];
}
Expand Down
2 changes: 1 addition & 1 deletion Classes/Provider/DataProviderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ public function getPrefilledSegments(NodeInterface $node): array;

public function getCategoryNode(NodeInterface $node): ?NodeInterface;

public function getPublicUrl(): string;
public function getPublicUrl(NodeInterface $node): string;
}
2 changes: 1 addition & 1 deletion Resources/Private/Fusion/Component/Form/Form.fusion
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ prototype(Garagist.Mautic:Component.Form) < prototype(Neos.Fusion:Component) {
}

id = ${q(node).property('mauticFormId')}
url = ${Mautic.getPublicUrl()}
url = ${Mautic.getPublicUrl(node)}
apiUrl = ${Configuration.Setting('Garagist.Mautic.api.baseUrl') || this.url}
embedType = ${Configuration.Setting('Garagist.Mautic.embedType')}
iframeClass = null
Expand Down
2 changes: 1 addition & 1 deletion Resources/Private/Fusion/Component/TrackingCode.fusion
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ prototype(Garagist.Mautic:Component.TrackingCode) < prototype(Neos.Fusion:Compon
doNotTrack = ${PropTypes.boolean}
}

url = ${Mautic.getPublicUrl()}
url = ${Mautic.getPublicUrl(node)}
enableTracking = ${Configuration.setting('Garagist.Mautic.enableTracking')}
doNotTrack = ${q(node).property('mauticDoNotTrack')}

Expand Down
2 changes: 1 addition & 1 deletion Resources/Private/Modules/Views/Index.fusion
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Garagist.Mautic.BackendController.index = Neos.Fusion:Component {
hasCategories = ${Carbon.Array.check(categories)}
showPagesWithoutEmails = ${this.hasPages && Array.some(pages, page => page.count > 0) ? 'false' : 'true'}
logo = ${ping ? 'Logo.svg' : 'LogoInactive.svg'}
mauticPublicUrl = ${Mautic.getPublicUrl()}
mauticPublicUrl = ${Mautic.getPublicUrl(node)}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


_i18n = ${Translation.id('').package('Garagist.Mautic').source('Module')}

Expand Down