Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Agreements.php
Go to the documentation of this file.
1 <?php
8 
10 
16 {
21 
28  public function __construct(
29  \Magento\Framework\View\Element\Template\Context $context,
30  \Magento\CheckoutAgreements\Model\ResourceModel\Agreement\CollectionFactory $agreementCollectionFactory,
31  array $data = []
32  ) {
33  $this->_agreementCollectionFactory = $agreementCollectionFactory;
34  parent::__construct($context, $data);
35  }
36 
40  public function getAgreements()
41  {
42  if (!$this->hasAgreements()) {
43  $agreements = [];
44  if ($this->_scopeConfig->isSetFlag('checkout/options/enable_agreements', ScopeInterface::SCOPE_STORE)) {
46  $agreements = $this->_agreementCollectionFactory->create();
47  $agreements->addStoreFilter($this->_storeManager->getStore()->getId());
48  $agreements->addFieldToFilter('is_active', 1);
49  }
50  $this->setAgreements($agreements);
51  }
52  return $this->getData('agreements');
53  }
54 }
getData($key='', $index=null)
Definition: DataObject.php:119
__construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\CheckoutAgreements\Model\ResourceModel\Agreement\CollectionFactory $agreementCollectionFactory, array $data=[])
Definition: Agreements.php:28