Skip to content

SYL-4341 Remove documentation links #74

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

Merged
merged 12 commits into from
Mar 31, 2025
Merged
Show file tree
Hide file tree
Changes from 8 commits
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
1 change: 1 addition & 0 deletions UPGRADE-2.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ The following service IDs have been removed:
| `sylius_mollie_plugin.behat.context.ui.admin.order` | `sylius_mollie.behat.context.ui.admin.order` |
| `sylius_mollie_plugin.behat.context.ui.admin.managing_orders` | `sylius_mollie.behat.context.ui.admin.managing_orders` |
| `sylius_mollie_plugin.command_bus` | `sylius_mollie.command_bus` |
| `sylius_mollie.documentation.documentation_links` | `@SyliusAdmin/PaymentMethod/_mollie_gateway_help_theme.html.twig` |

1. Removed parameters:

Expand Down
25 changes: 0 additions & 25 deletions config/services/documentation.xml

This file was deleted.

7 changes: 0 additions & 7 deletions config/services/form.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@

<services>
<service id="sylius_mollie.form.type.mollie_gateway_configuration" class="Sylius\MolliePlugin\Form\Type\MollieGatewayConfigurationType">
<argument type="service" id="sylius_mollie.documentation.documentation_links"/>
<argument type="service" id="sylius_mollie.mollie_api_client"/>
<tag name="sylius.gateway_configuration_type" type="mollie" label="sylius_mollie_plugin.ui.mollie_gateway_label"/>
<tag name="form.type"/>
Expand Down Expand Up @@ -134,12 +133,6 @@
<tag name="form.type" />
</service>

<service id="sylius_mollie.form.type.payment_type_choice" class="Sylius\MolliePlugin\Form\Type\PaymentTypeChoiceType">
<argument type="service" id="sylius_mollie.documentation.documentation_links" />

<tag name="form.type" />
</service>

<service id="sylius_mollie.form.type.payment_surcharge_type_choice" class="Sylius\MolliePlugin\Form\Type\PaymentSurchargeFeeTypeChoiceType">
<tag name="form.type" />
</service>
Expand Down
78 changes: 0 additions & 78 deletions src/Documentation/DocumentationLinks.php

This file was deleted.

25 changes: 0 additions & 25 deletions src/Documentation/DocumentationLinksInterface.php

This file was deleted.

8 changes: 2 additions & 6 deletions src/Form/Type/MollieGatewayConfigurationType.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
namespace Sylius\MolliePlugin\Form\Type;

use Sylius\MolliePlugin\Client\MollieApiClient;
use Sylius\MolliePlugin\Documentation\DocumentationLinksInterface;
use Sylius\MolliePlugin\Validator\Constraints\LiveApiKeyIsNotBlank;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
Expand All @@ -34,7 +33,7 @@ final class MollieGatewayConfigurationType extends AbstractType

public const API_KEY_TEST = 'api_key_test';

public function __construct(private readonly DocumentationLinksInterface $documentationLinks, private readonly MollieApiClient $apiClient)
public function __construct(private readonly MollieApiClient $apiClient)
{
}

Expand All @@ -52,8 +51,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
])
->add(self::API_KEY_TEST, PasswordType::class, [
'always_empty' => false,
'label' => $this->documentationLinks->getApiKeyDoc(),
'help' => ' ',
'label' => 'sylius_mollie_plugin.ui.api_key_test',
'constraints' => [
new NotBlank([
'message' => 'sylius_mollie_plugin.api_key.not_blank',
Expand Down Expand Up @@ -105,13 +103,11 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
->add('components', CheckboxType::class, [
'label' => 'sylius_mollie_plugin.ui.enable_components',
'attr' => ['class' => 'mollie-components'],
'help' => $this->documentationLinks->getMollieComponentsDoc(),
'help_html' => true,
])
->add('single_click_enabled', CheckboxType::class, [
'label' => 'sylius_mollie_plugin.ui.single_click_enabled',
'attr' => ['class' => 'mollie-single-click-payment'],
'help' => $this->documentationLinks->getSingleClickDoc(),
'help_html' => true,
])
->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event): void {
Expand Down
8 changes: 1 addition & 7 deletions src/Form/Type/PaymentTypeChoiceType.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,19 @@

namespace Sylius\MolliePlugin\Form\Type;

use Sylius\MolliePlugin\Documentation\DocumentationLinksInterface;
use Sylius\MolliePlugin\Payments\PaymentType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\OptionsResolver\OptionsResolver;

final class PaymentTypeChoiceType extends AbstractType
{
public function __construct(
private readonly DocumentationLinksInterface $documentationLinks,
) {
}

public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'label' => 'sylius_mollie_plugin.ui.payment_type',
'choices' => PaymentType::getAllAvailable(),
'help' => $this->documentationLinks->getPaymentMethodDoc(),
'help' => 'sylius_mollie_plugin.help.payment_methods_doc',
'help_html' => true,
]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
</label>
<div class="ui input">
{{ form_widget(field) }}
<button id="{{ field.vars.name }}" type="button" class="ui button primary">{{ 'sylius_mollie_plugin.ui.show_hide'|trans }}</button>
<button id="{{ field.vars.name }}" type="button" class="ui button primary">
{{ 'sylius_mollie_plugin.ui.show_hide'|trans }}
</button>
</div>

{{ form_help(field) }}
{{ form_errors(field) }}
</div>
Expand All @@ -19,4 +22,5 @@
{{ 'sylius_mollie_plugin.ui.test_api_keys'|trans }}
</button>
</div>

<div class="ui test-api-key-div"></div>
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
</label>
<div class="ui input js-onboardingWizard-apiKey">
{{ form_widget(field) }}
<button id="{{ field.vars.name }}" type="button" class="ui button primary">{{ 'sylius_mollie_plugin.ui.show_hide'|trans }}</button>
<button id="{{ field.vars.name }}" type="button" class="ui button primary">
{{ 'sylius_mollie_plugin.ui.show_hide'|trans }}
</button>
</div>

{{ form_help(field) }}
{{ form_errors(field) }}
</div>
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% import '@SyliusUi/Macro/flags.html.twig' as flags %}
{% form_theme form '@SyliusAdmin/PaymentMethod/_mollie_gateway_help_theme.html.twig' %}

{% set mollieStandardGateway = constant('Sylius\\MolliePlugin\\Factory\\MollieGatewayFactory::FACTORY_NAME') %}
{% set mollieRecuringGateway = constant('Sylius\\MolliePlugin\\Factory\\MollieSubscriptionGatewayFactory::FACTORY_NAME') %}
Expand All @@ -23,51 +24,46 @@
<div class="ui segment">
<h4 class="ui dividing header">{{ 'sylius.ui.gateway_configuration'|trans }}</h4>
{{ form_row(form.gatewayConfig.factoryName) }}

{% if form.gatewayConfig.config is defined %}
{% for field in form.gatewayConfig.config %}
{% if loop.index is odd and field.vars.name != 'api_key_test' %}
<div class="two field">
{% endif %}
{% if field.vars.name == 'environment'%}
{{ form_widget(field, { 'attr': { 'class': 'js-onboardingWizard-environment' } }) }}
{{ form_errors(field) }}
{% elseif field.vars.name == 'profile_id'%}
</div>
{% endif %}

<div class="two field js-onboardingWizard-profile-api">
<div class="js-two-fields-test">
{% if field.vars.name == 'environment' %}
{{ form_widget(field, { 'attr': { 'class': 'js-onboardingWizard-environment' } }) }}
{{ form_errors(field) }}

{% elseif field.vars.name == 'profile_id' %}
</div>
<div class="two field js-onboardingWizard-profile-api">
<div class="js-two-fields-test">
<div class="required field">
<label
for="sylius_payment_method_gatewayConfig_config_profile_id"
class="required"
>
{{ field.vars.label|trans|raw|nl2br }}
</label>
{{ form_widget(field) }}
{{ form_errors(field) }}
</div>
{% elseif field.vars.name == 'api_key_test' %}
{% include 'bundles/SyliusAdminBundle/PaymentMethod/_api_test_key.html.twig' %}
</div>
{% elseif field.vars.name == 'api_key_live' %}
{% include 'bundles/SyliusAdminBundle/PaymentMethod/_api_live_key.html.twig' %}
<label for="sylius_payment_method_gatewayConfig_config_profile_id" class="required">
{{ field.vars.label|trans|raw|nl2br }}
</label>
{{ form_widget(field) }}
{{ form_errors(field) }}
</div>
{% elseif field.vars.name == 'components' %}
<div class="js-onboardingWizard-mollieComponents">
{{ form_row(field) }}
</div>
{% elseif field.vars.name == 'single_click_enabled' %}
<div class="js-onboardingWizard-singleClick">
{{ form_row(field) }}
</div>
{% else %}
{{ form_row(field) }}
{{ form_help(field) }}
{% endif %}
{% if loop.index is even and field.vars.name != 'profile_id' %}</div>{% endif %}
{% endfor %}
{% endif %}
</div>

{% elseif field.vars.name == 'api_key_test' %}
{% include 'bundles/SyliusAdminBundle/PaymentMethod/_api_test_key.html.twig' %}
</div>

{% elseif field.vars.name == 'api_key_live' %}
{% include 'bundles/SyliusAdminBundle/PaymentMethod/_api_live_key.html.twig' %}
</div>

{% else %}
{{ form_row(field) }}
{{ form_help(field) }}
{% endif %}

{% if loop.index is even and field.vars.name != 'profile_id' %}</div>{% endif %}
{% endfor %}
{% endif %}
</div>

{% if form.vars.value.gatewayConfig.factoryName in [mollieStandardGateway, mollieRecuringGateway] %}
{% include 'bundles/SyliusAdminBundle/PaymentMethod/_mollieMethodsForm.html.twig' %}
Expand Down
Copy link
Member

Choose a reason for hiding this comment

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

Newly added templates should be added to the proper plugin templates directory, the others could be refactored in a separate PR. Could you open such a PR after merging this one? 🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure! 🫡

Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{% extends '@SyliusUi/Form/theme.html.twig' %}

{% block form_help %}
{% if help is empty and help is not same as(false) %}
{% set name = name ?? id|split('_')|last %}

{% if name == 'api_key_test' %}
<div class="ui pointing label">
{{ 'sylius_mollie_plugin.ui.read_more_test_api_key'|trans({
'%link%': '<a target="_blank" href="https://www.mollie.com/dashboard/developers/api-keys">' ~ 'sylius_mollie_plugin.ui.mollie_profile'|trans ~ '</a>'
})|raw }}
</div>
{% elseif name == 'api_key_live' %}
<div class="ui pointing label">
{{ 'sylius_mollie_plugin.ui.read_more_live_api_key'|trans({
'%link%': '<a target="_blank" href="https://www.mollie.com/dashboard/developers/api-keys">' ~ 'sylius_mollie_plugin.ui.mollie_profile'|trans ~ '</a>'
})|raw }}
</div>
{% elseif name == 'components' %}
<div class="ui pointing label">
{{ 'sylius_mollie_plugin.ui.read_more_enable_components'|trans({
'%link%': '<a target="_blank" href="https://www.mollie.com/en/news/post/better-checkout-flows-with-mollie-components">' ~ 'sylius_mollie_plugin.ui.mollie_components'|trans ~ '</a>'
})|raw }}
</div>
{% elseif name == 'single_click_enabled' %}
<div class="ui pointing label">
{{ 'sylius_mollie_plugin.ui.read_more_single_click_enabled'|trans({
'%link%': '<a target="_blank" href="https://help.mollie.com/hc/en-us/articles/115000671249-What-are-single-click-payments-and-how-does-it-work-">' ~ 'sylius_mollie_plugin.ui.mollie_single_click'|trans ~ '</a>'
})|raw }}
</div>
{% else %}
{{ parent() }}
{% endif %}
{% else %}
{{ parent() }}
{% endif %}
{% endblock %}
2 changes: 1 addition & 1 deletion tests/Behat/Page/Admin/PaymentMethod/CreatePage.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final class CreatePage extends BaseCreatePage implements CreatePageInterface
*/
public function setApiKey(string $apiKey): void
{
$this->getDocument()->fillField('Test API Key *', $apiKey);
$this->getDocument()->fillField('Test API Key', $apiKey);
}

/**
Expand Down
Loading