-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #57 from mailchimp/develop
version 1.0.21
- Loading branch information
Showing
112 changed files
with
5,605 additions
and
800 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<?php | ||
/** | ||
* mc-magento2 Magento Component | ||
* | ||
* @category Ebizmarts | ||
* @package mc-magento2 | ||
* @author Ebizmarts Team <info@ebizmarts.com> | ||
* @copyright Ebizmarts (http://ebizmarts.com) | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
* @date: 4/10/17 1:08 PM | ||
* @file: Edit.php | ||
*/ | ||
|
||
namespace Ebizmarts\MailChimp\Block\Adminhtml\Stores; | ||
|
||
use Magento\Backend\Block\Widget\Form\Container; | ||
use Magento\Backend\Block\Widget\Context; | ||
use Magento\Framework\Registry; | ||
|
||
class Edit extends Container | ||
{ | ||
/** | ||
* @var Registry | ||
*/ | ||
protected $_coreRegistry; | ||
/** | ||
* Edit constructor. | ||
* @param Context $context | ||
* @param Registry $registry | ||
* @param array $data | ||
*/ | ||
public function __construct( | ||
Context $context, | ||
Registry $registry, | ||
array $data = [] | ||
) { | ||
|
||
$this->_coreRegistry = $registry; | ||
parent::__construct($context, $data); | ||
} | ||
protected function _construct() | ||
{ | ||
$this->_objectId = 'id'; | ||
$this->_controller = 'adminhtml_stores'; | ||
$this->_blockGroup = 'Ebizmarts_MailChimp'; | ||
|
||
parent::_construct(); | ||
|
||
$this->buttonList->update('save', 'label', __('Save')); | ||
$this->buttonList->add( | ||
'saveandcontinue', | ||
[ | ||
'label' => __('Save and Continue Edit'), | ||
'class' => 'save', | ||
'data_attribute' => [ | ||
'mage-init' => [ | ||
'button' => [ | ||
'event' => 'saveAndContinueEdit', | ||
'target' => '#edit_form' | ||
] | ||
] | ||
] | ||
], | ||
-100 | ||
); | ||
$this->buttonList->update('delete', 'label', __('Delete')); | ||
} | ||
|
||
/** | ||
* Retrieve text for header element depending on loaded news | ||
* | ||
* @return string | ||
*/ | ||
public function getHeaderText() | ||
{ | ||
$storeRegistry = $this->_coreRegistry->registry('mailchimp_stores'); | ||
if ($storeRegistry->getId()) { | ||
$storeTitle = $this->escapeHtml($storeRegistry->getTitle()); | ||
return __("Edit Store '%1'", $storeTitle); | ||
} else { | ||
return __('Add Store'); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
/** | ||
* mc-magento2 Magento Component | ||
* | ||
* @category Ebizmarts | ||
* @package mc-magento2 | ||
* @author Ebizmarts Team <info@ebizmarts.com> | ||
* @copyright Ebizmarts (http://ebizmarts.com) | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
* @date: 4/10/17 4:04 PM | ||
* @file: Form.php | ||
*/ | ||
|
||
namespace Ebizmarts\MailChimp\Block\Adminhtml\Stores\Edit; | ||
|
||
use Magento\Backend\Block\Widget\Form\Generic; | ||
|
||
class Form extends Generic | ||
{ | ||
protected function _prepareForm() | ||
{ | ||
/** @var \Magento\Framework\Data\Form $form */ | ||
$form = $this->_formFactory->create( | ||
[ | ||
'data' => [ | ||
'id' => 'edit_form', | ||
'action' => $this->getData('action'), | ||
'method' => 'post' | ||
] | ||
] | ||
); | ||
$form->setUseContainer(true); | ||
$this->setForm($form); | ||
|
||
return parent::_prepareForm(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
<?php | ||
/** | ||
* mc-magento2 Magento Component | ||
* | ||
* @category Ebizmarts | ||
* @package mc-magento2 | ||
* @author Ebizmarts Team <info@ebizmarts.com> | ||
* @copyright Ebizmarts (http://ebizmarts.com) | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
* @date: 4/12/17 5:07 PM | ||
* @file: Address.php | ||
*/ | ||
namespace Ebizmarts\MailChimp\Block\Adminhtml\Stores\Edit\Tab; | ||
|
||
use Magento\Backend\Block\Widget\Form\Generic; | ||
use Magento\Backend\Block\Widget\Tab\TabInterface; | ||
use Magento\Backend\Block\Template\Context; | ||
use Magento\Framework\Registry; | ||
use Magento\Framework\Data\FormFactory; | ||
|
||
class Address extends Generic implements TabInterface | ||
{ | ||
/** | ||
* @var \Magento\Directory\Model\Config\Source\Country | ||
*/ | ||
protected $_country; | ||
|
||
/** | ||
* Address constructor. | ||
* @param Context $context | ||
* @param Registry $registry | ||
* @param FormFactory $formFactory | ||
* @param \Magento\Directory\Model\Config\Source\Country $country | ||
* @param array $data | ||
*/ | ||
public function __construct( | ||
\Magento\Backend\Block\Template\Context $context, | ||
\Magento\Framework\Registry $registry, | ||
\Magento\Framework\Data\FormFactory $formFactory, | ||
\Magento\Directory\Model\Config\Source\Country $country, | ||
array $data = [] | ||
) { | ||
|
||
$this->_country = $country; | ||
parent::__construct($context, $registry, $formFactory, $data); | ||
} | ||
|
||
|
||
protected function _prepareForm() | ||
{ | ||
$model = $this->_coreRegistry->registry('mailchimp_stores'); | ||
$form = $this->_formFactory->create(); | ||
$form->setHtmlIdPrefix('stores_'); | ||
$form->setFieldNameSuffix('stores'); | ||
$fieldset = $form->addFieldset( | ||
'base_fieldset', | ||
['legend' => __('Address')] | ||
); | ||
if ($model->getId()) { | ||
$fieldset->addField( | ||
'id', | ||
'hidden', | ||
['name' => 'id'] | ||
); | ||
} | ||
$fieldset->addField( | ||
'address_address_one', | ||
'text', | ||
[ | ||
'name' => 'address_address_one', | ||
'label' => __('Street'), | ||
'required' => true | ||
] | ||
); | ||
$fieldset->addField( | ||
'address_address_two', | ||
'text', | ||
[ | ||
'name' => 'address_address_two', | ||
'label' => __('Street'), | ||
'required' => false | ||
] | ||
); | ||
$fieldset->addField( | ||
'address_city', | ||
'text', | ||
[ | ||
'name' => 'address_city', | ||
'label' => __('City'), | ||
'required' => true | ||
] | ||
); | ||
$fieldset->addField( | ||
'address_postal_code', | ||
'text', | ||
[ | ||
'name' => 'address_postal_code', | ||
'label' => __('Postal Code'), | ||
'required' => false | ||
] | ||
); | ||
$country = $this->_country->toOptionArray(); | ||
$countryArray = [''=> __('Select one')]; | ||
foreach ($country as $c) { | ||
$countryArray[$c['value']] = $c['label']; | ||
} | ||
$fieldset->addField( | ||
'address_country_code', | ||
'select', | ||
[ | ||
'name' => 'address_country_code', | ||
'label' => __('Country'), | ||
'required' => true, | ||
'options' => $countryArray | ||
] | ||
); | ||
|
||
|
||
$data = $model->getData(); | ||
$form->setValues($data); | ||
$this->setForm($form); | ||
|
||
return parent::_prepareForm(); | ||
} | ||
public function getTabLabel() | ||
{ | ||
return __('Store Address Info'); | ||
} | ||
public function getTabTitle() | ||
{ | ||
return __('Store Address Info'); | ||
} | ||
public function canShowTab() | ||
{ | ||
return true; | ||
} | ||
public function isHidden() | ||
{ | ||
return false; | ||
} | ||
} |
Oops, something went wrong.