Skip to content

Commit db064c0

Browse files
MC-41603: Add new options to configure PayPal PayLater styles to System configuration
- change system config source to implement OptionSourceInterface
1 parent 45b7b25 commit db064c0

File tree

9 files changed

+70
-57
lines changed

9 files changed

+70
-57
lines changed

app/code/Magento/Paypal/Model/System/Config/Source/PayLater/Color.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,26 @@
77

88
namespace Magento\Paypal\Model\System\Config\Source\PayLater;
99

10+
use Magento\Framework\Data\OptionSourceInterface;
11+
1012
/**
1113
* Source model for PayLater banner color
1214
*/
13-
class Color
15+
class Color implements OptionSourceInterface
1416
{
1517
/**
16-
* PayLater colors source getter for Catalog Product Page
18+
* PayLater colors source
1719
*
1820
* @return array
1921
*/
20-
public function getColorsCPP(): array
22+
public function toOptionArray(): array
2123
{
2224
return [
23-
'blue' => __('Blue'),
24-
'black' => __('Black'),
25-
'white' => __('White'),
26-
'white-no-border' => __('White No Border'),
27-
'gray' => __('Gray')
25+
['value' => 'blue', 'label' => __('Blue')],
26+
['value' => 'black', 'label' => __('Black')],
27+
['value' => 'white', 'label' => __('White')],
28+
['value' => 'white-no-border', 'label' => __('White No Border')],
29+
['value' => 'gray', 'label' => __('Gray')]
2830
];
2931
}
3032
}

app/code/Magento/Paypal/Model/System/Config/Source/PayLater/LogoPosition.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,24 @@
77

88
namespace Magento\Paypal\Model\System\Config\Source\PayLater;
99

10+
use Magento\Framework\Data\OptionSourceInterface;
11+
1012
/**
1113
* Source model for PayLater banner logo position
1214
*/
13-
class LogoPosition
15+
class LogoPosition implements OptionSourceInterface
1416
{
1517
/**
16-
* PayLater logo positions source getter for Catalog Product Page
18+
* PayLater logo positions source
1719
*
1820
* @return array
1921
*/
20-
public function getLogoPositionsCPP(): array
22+
public function toOptionArray(): array
2123
{
2224
return [
23-
'left' => __('Left'),
24-
'right' => __('Right'),
25-
'top' => __('Top')
25+
['value' => 'left', 'label' => __('Left')],
26+
['value' => 'right', 'label' => __('Right')],
27+
['value' => 'top', 'label' => __('Top')]
2628
];
2729
}
2830
}

app/code/Magento/Paypal/Model/System/Config/Source/PayLater/LogoType.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,25 @@
77

88
namespace Magento\Paypal\Model\System\Config\Source\PayLater;
99

10+
use Magento\Framework\Data\OptionSourceInterface;
11+
1012
/**
1113
* Source model for PayLater banner logo type
1214
*/
13-
class LogoType
15+
class LogoType implements OptionSourceInterface
1416
{
1517
/**
16-
* PayLater logo types source getter for Catalog Product Page
18+
* PayLater logo types source
1719
*
1820
* @return array
1921
*/
20-
public function getLogoTypesCPP(): array
22+
public function toOptionArray(): array
2123
{
2224
return [
23-
'primary' => __('Primary'),
24-
'alternative' => __('Alternative'),
25-
'inline' => __('Inline'),
26-
'none' => __('None')
25+
['value' => 'primary', 'label' => __('Primary')],
26+
['value' => 'alternative', 'label' => __('Alternative')],
27+
['value' => 'inline', 'label' => __('Inline')],
28+
['value' => 'none', 'label' => __('None')]
2729
];
2830
}
2931
}

app/code/Magento/Paypal/Model/System/Config/Source/PayLater/Ratio.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,25 @@
77

88
namespace Magento\Paypal\Model\System\Config\Source\PayLater;
99

10+
use Magento\Framework\Data\OptionSourceInterface;
11+
1012
/**
1113
* Source model for PayLater banner ratio
1214
*/
13-
class Ratio
15+
class Ratio implements OptionSourceInterface
1416
{
1517
/**
16-
* PayLater ratios source getter for Catalog Product Page
18+
* PayLater ratios source
1719
*
1820
* @return array
1921
*/
20-
public function getRatiosCPP(): array
22+
public function toOptionArray(): array
2123
{
2224
return [
23-
'1x1' => '1x1',
24-
'1x4' => '1x4',
25-
'8x1' => '8x1',
26-
'20x1' => '20x1'
25+
['value' => '1x1', 'label' => '1x1'],
26+
['value' => '1x4', 'label' => '1x4'],
27+
['value' => '8x1', 'label' => '8x1'],
28+
['value' => '20x1', 'label' => '20x1']
2729
];
2830
}
2931
}

app/code/Magento/Paypal/Model/System/Config/Source/PayLater/StyleLayout.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,23 @@
77

88
namespace Magento\Paypal\Model\System\Config\Source\PayLater;
99

10+
use Magento\Framework\Data\OptionSourceInterface;
11+
1012
/**
1113
* Source model for PayLater banner style layout
1214
*/
13-
class StyleLayout
15+
class StyleLayout implements OptionSourceInterface
1416
{
1517
/**
16-
* PayLater style layouts source getter for Catalog Product Page
18+
* PayLater style layouts source
1719
*
1820
* @return array
1921
*/
20-
public function getStyleLayoutsCPP(): array
22+
public function toOptionArray(): array
2123
{
2224
return [
23-
'text' => __('Text'),
24-
'flex' => __('Flex')
25+
['value' => 'text', 'label' => __('Text')],
26+
['value' => 'flex', 'label' => __('Flex')]
2527
];
2628
}
2729
}

app/code/Magento/Paypal/Model/System/Config/Source/PayLater/TextColor.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,23 @@
77

88
namespace Magento\Paypal\Model\System\Config\Source\PayLater;
99

10+
use Magento\Framework\Data\OptionSourceInterface;
11+
1012
/**
1113
* Source model for PayLater banner text color
1214
*/
13-
class TextColor
15+
class TextColor implements OptionSourceInterface
1416
{
1517
/**
16-
* PayLater text colors source getter for Catalog Product Page
18+
* PayLater text colors source
1719
*
1820
* @return array
1921
*/
20-
public function getTextColorsCPP(): array
22+
public function toOptionArray(): array
2123
{
2224
return [
23-
'black' => __('Black'),
24-
'white' => __('White')
25+
['value' => 'black', 'label' => __('Black')],
26+
['value' => 'white', 'label' => __('White')]
2527
];
2628
}
2729
}

app/code/Magento/Paypal/Model/System/Config/Source/PayLater/TextSize.php

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,28 @@
77

88
namespace Magento\Paypal\Model\System\Config\Source\PayLater;
99

10+
use Magento\Framework\Data\OptionSourceInterface;
11+
1012
/**
1113
* Source model for PayLater banner text size
1214
*/
13-
class TextSize
15+
class TextSize implements OptionSourceInterface
1416
{
1517
/**
16-
* PayLater text sizes source getter for Catalog Product Page
18+
* PayLater text sizes source
1719
*
1820
* @return array
1921
*/
20-
public function getTextSizesCPP(): array
22+
public function toOptionArray(): array
2123
{
2224
return [
23-
'10' => '10px',
24-
'11' => '11px',
25-
'12' => '12px',
26-
'13' => '13px',
27-
'14' => '14px',
28-
'15' => '15px',
29-
'16' => '16px'
25+
['value' => '10', 'label' => '10px'],
26+
['value' => '11', 'label' => '11px'],
27+
['value' => '12', 'label' => '12px'],
28+
['value' => '13', 'label' => '13px'],
29+
['value' => '14', 'label' => '14px'],
30+
['value' => '15', 'label' => '15px'],
31+
['value' => '16', 'label' => '16px']
3032
];
3133
}
3234
}

app/code/Magento/Paypal/etc/adminhtml/system/express_checkout.xml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@
345345
<field id="paylater_productpage_stylelayout" translate="label" type="select" showInDefault="1" showInWebsite="1" sortOrder="30">
346346
<label>Style Layout</label>
347347
<config_path>payment/paypal_paylater/productpage_stylelayout</config_path>
348-
<source_model>Magento\Paypal\Model\System\Config\Source\PayLater\StyleLayout::getStyleLayoutsCPP</source_model>
348+
<source_model>Magento\Paypal\Model\System\Config\Source\PayLater\StyleLayout</source_model>
349349
<attribute type="shared">1</attribute>
350350
<depends>
351351
<field id="paylater_productpage_display">1</field>
@@ -354,7 +354,7 @@
354354
<field id="paylater_productpage_logotype" translate="label" type="select" showInDefault="1" showInWebsite="1" sortOrder="40">
355355
<label>Logo Type</label>
356356
<config_path>payment/paypal_paylater/productpage_logotype</config_path>
357-
<source_model>Magento\Paypal\Model\System\Config\Source\PayLater\LogoType::getLogoTypesCPP</source_model>
357+
<source_model>Magento\Paypal\Model\System\Config\Source\PayLater\LogoType</source_model>
358358
<attribute type="shared">1</attribute>
359359
<depends>
360360
<field id="paylater_productpage_display">1</field>
@@ -364,7 +364,7 @@
364364
<field id="paylater_productpage_logoposition" translate="label" type="select" showInDefault="1" showInWebsite="1" sortOrder="50">
365365
<label>Logo Position</label>
366366
<config_path>payment/paypal_paylater/productpage_logoposition</config_path>
367-
<source_model>Magento\Paypal\Model\System\Config\Source\PayLater\LogoPosition::getLogoPositionsCPP</source_model>
367+
<source_model>Magento\Paypal\Model\System\Config\Source\PayLater\LogoPosition</source_model>
368368
<attribute type="shared">1</attribute>
369369
<depends>
370370
<field id="paylater_productpage_display">1</field>
@@ -375,7 +375,7 @@
375375
<field id="paylater_productpage_textcolor" translate="label" type="select" showInDefault="1" showInWebsite="1" sortOrder="60">
376376
<label>Text Color</label>
377377
<config_path>payment/paypal_paylater/productpage_textcolor</config_path>
378-
<source_model>Magento\Paypal\Model\System\Config\Source\PayLater\TextColor::getTextColorsCPP</source_model>
378+
<source_model>Magento\Paypal\Model\System\Config\Source\PayLater\TextColor</source_model>
379379
<attribute type="shared">1</attribute>
380380
<depends>
381381
<field id="paylater_productpage_display">1</field>
@@ -385,7 +385,7 @@
385385
<field id="paylater_productpage_textsize" translate="label" type="select" showInDefault="1" showInWebsite="1" sortOrder="70">
386386
<label>Text Size</label>
387387
<config_path>payment/paypal_paylater/productpage_textsize</config_path>
388-
<source_model>Magento\Paypal\Model\System\Config\Source\PayLater\TextSize::getTextSizesCPP</source_model>
388+
<source_model>Magento\Paypal\Model\System\Config\Source\PayLater\TextSize</source_model>
389389
<attribute type="shared">1</attribute>
390390
<depends>
391391
<field id="paylater_productpage_display">1</field>
@@ -395,7 +395,7 @@
395395
<field id="paylater_productpage_ratio" translate="label" type="select" showInDefault="1" showInWebsite="1" sortOrder="80">
396396
<label>Ratio</label>
397397
<config_path>payment/paypal_paylater/productpage_ratio</config_path>
398-
<source_model>Magento\Paypal\Model\System\Config\Source\PayLater\Ratio::getRatiosCPP</source_model>
398+
<source_model>Magento\Paypal\Model\System\Config\Source\PayLater\Ratio</source_model>
399399
<attribute type="shared">1</attribute>
400400
<depends>
401401
<field id="paylater_productpage_display">1</field>
@@ -405,7 +405,7 @@
405405
<field id="paylater_productpage_color" translate="label" type="select" showInDefault="1" showInWebsite="1" sortOrder="90">
406406
<label>Color</label>
407407
<config_path>payment/paypal_paylater/productpage_color</config_path>
408-
<source_model>Magento\Paypal\Model\System\Config\Source\PayLater\Color::getColorsCPP</source_model>
408+
<source_model>Magento\Paypal\Model\System\Config\Source\PayLater\Color</source_model>
409409
<attribute type="shared">1</attribute>
410410
<depends>
411411
<field id="paylater_productpage_display">1</field>

app/code/Magento/Paypal/i18n/en_US.csv

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -740,12 +740,11 @@ User,User
740740
"A successful payment transaction has already been completed. Please, check if the order has been placed.","A successful payment transaction has already been completed. Please, check if the order has been placed."
741741
"Advertise PayPal PayLater","Advertise PayPal PayLater"
742742
"Enable PayPal PayLater","Enable PayPal PayLater"
743-
"Display","Display"
744-
"Position","Position"
745743
"Style Layout","Style Layout"
746744
"Logo Type","Logo Type"
747745
"Logo Position","Logo Position"
748746
"Text Color","Text Color"
747+
"Text Size","Text Size"
749748
"Ratio","Ratio"
750749
"White","White"
751750
"White No Border","White No Border"

0 commit comments

Comments
 (0)