Skip to content

Commit 0831af6

Browse files
authored
Merge pull request #89 from JerrySmidt/master
3.2.0
2 parents 93d21b8 + 77631e6 commit 0831af6

39 files changed

+866
-501
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
.DS_Store
33
vendor
44
composer.lock
5-
.idea/
5+
.idea/
6+
.eslintrc

Api/PostcodeModelInterface.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
namespace Flekto\Postcode\Api;
44

5-
use Flekto\Postcode\Helper\ApiClientHelper;
6-
75
interface PostcodeModelInterface
86
{
97

Block/Customer/Address.php

Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?php
2+
3+
namespace Flekto\Postcode\Block\Customer\Address;
4+
5+
class Autofill extends \Magento\Framework\View\Element\Template
6+
{
7+
/**
8+
* @var \Magento\Framework\View\LayoutInterface
9+
*/
10+
protected $_layout;
11+
12+
/**
13+
* Constructor
14+
*
15+
* @param \Magento\Framework\View\Element\Template\Context $context
16+
* @param array $data
17+
*/
18+
public function __construct(
19+
\Magento\Framework\View\Element\Template\Context $context,
20+
array $data = []
21+
) {
22+
$this->_layout = $context->getLayout();
23+
parent::__construct($context, $data);
24+
}
25+
26+
/**
27+
* Render block HTML
28+
*
29+
* @return string
30+
*/
31+
protected function _toHtml(): string
32+
{
33+
return $this->hasAddressFields() ? parent::_toHtml() : '';
34+
}
35+
36+
/**
37+
* Check whether address fields are shown in the current layout.
38+
*
39+
* @return bool
40+
*/
41+
private function hasAddressFields(): bool
42+
{
43+
if (!empty($this->_layout->getBlock('customer_address_edit'))) {
44+
return true;
45+
}
46+
47+
$registerBlock = $this->_layout->getBlock('customer_form_register');
48+
if (!empty($registerBlock) && $registerBlock->getData('show_address_fields')) {
49+
return true;
50+
}
51+
52+
return false;
53+
}
54+
}

Cron/UpdateApiData.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,9 @@ public function __construct(
3737
}
3838

3939
/**
40-
* execute function.
41-
*
42-
* @access public
43-
* @return void
40+
* Update Postcode.eu API account data.
4441
*/
45-
public function execute()
42+
public function execute(): void
4643
{
4744
if (!$this->_storeConfigHelper->hasCredentials()) {
4845
return; // No credentials so nothing to do here.

0 commit comments

Comments
 (0)