本文整理汇总了PHP中Magento\Framework\View\Element\Template::_construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Template::_construct方法的具体用法?PHP Template::_construct怎么用?PHP Template::_construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\View\Element\Template
的用法示例。
在下文中一共展示了Template::_construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _construct
/**
* @return void
*/
protected function _construct()
{
$this->_loadData();
$this->setStores([]);
$this->setLanguages([]);
return parent::_construct();
}
示例2: _construct
/**
* @return void
*/
protected function _construct()
{
parent::_construct();
//TODO: add full name logic
$orders = $this->_orderCollectionFactory->create()->addAttributeToSelect('*')->joinAttribute('shipping_firstname', 'order_address/firstname', 'shipping_address_id', null, 'left')->joinAttribute('shipping_lastname', 'order_address/lastname', 'shipping_address_id', null, 'left')->addAttributeToFilter('customer_id', $this->_customerSession->getCustomerId())->addAttributeToFilter('status', array('in' => $this->_orderConfig->getVisibleOnFrontStatuses()))->addAttributeToSort('created_at', 'desc')->setPageSize('5')->load();
$this->setOrders($orders);
}
示例3: _construct
protected function _construct()
{
parent::_construct();
// CSRF protection
$this->_customerSession->setFacebookCsrf($csrf = md5(uniqid(rand(), true)));
$this->_clientFacebook->setState($csrf);
}
示例4: _construct
/**
* load the articles
*/
protected function _construct()
{
parent::_construct();
/** @var \Gemtoo\Blog\Model\ResourceModel\Article\Collection $articles */
$articles = $this->articleCollectionFactory->create()->addFieldToSelect('*')->addFieldToFilter('is_active', 1)->addStoreFilter($this->_storeManager->getStore()->getId())->setOrder('name', 'ASC');
$this->setArticles($articles);
}
示例5: _construct
protected function _construct()
{
parent::_construct();
/** @var \Sample\News\Model\Resource\Author\Collection $authors */
$collection = $this->_testimonialFactory->create()->getCollection()->addFieldToFilter('status', 1);
$this->setTestimonial($collection);
}
示例6: _construct
public function _construct()
{
if (!$this->getConfig('general_settings/enable')) {
return;
}
parent::_construct();
}
示例7: _construct
public function _construct()
{
if (!$this->hasData('template')) {
$this->setData('template', self::DEFAULT_REVIEW_TEMPLATE);
}
return parent::_construct();
}
示例8: _construct
/**
* @return void
*/
protected function _construct()
{
parent::_construct();
$orders = $this->_orderCollectionFactory->create()->addFieldToSelect('*')->addFieldToFilter('customer_id', $this->_customerSession->getCustomerId())->addFieldToFilter('status', array('in' => $this->_orderConfig->getVisibleOnFrontStatuses()))->setOrder('created_at', 'desc');
$this->setOrders($orders);
$this->pageConfig->setTitle(__('My Orders'));
}
示例9: _construct
/**
* load the authors
*/
protected function _construct()
{
parent::_construct();
/** @var \Sample\News\Model\ResourceModel\Author\Collection $authors */
$authors = $this->authorCollectionFactory->create()->addFieldToSelect('*')->addFieldToFilter('is_active', 1)->addStoreFilter($this->_storeManager->getStore()->getId())->setOrder('name', 'ASC');
$this->setAuthors($authors);
}
示例10: _construct
/**
* Init orders
*
* @return void
*/
protected function _construct()
{
parent::_construct();
if ($this->httpContext->getValue(Context::CONTEXT_AUTH)) {
$this->initOrders();
}
}
示例11: _construct
protected function _construct()
{
parent::_construct();
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$postCollectionFactory = $objectManager->create('\\Test\\Testimonials\\Model\\ResourceModel\\Post\\CollectionFactory');
$this->_postCollectionFactory = $postCollectionFactory;
$this->setTemplate('widget/Testimonials.phtml');
}
示例12: _construct
/**
* Add block data
* @return void
*/
protected function _construct()
{
parent::_construct();
$this->_urls = array('base' => $this->_storeManager->getStore()->getBaseUrl('web'), 'baseSecure' => $this->_storeManager->getStore()->getBaseUrl('web', true), 'current' => $this->_request->getRequestUri());
$this->addBodyClass($this->_request->getFullActionName('-'));
if ($this->_cacheState->isEnabled(self::CACHE_GROUP)) {
$this->_sidResolver->setUseSessionVar(true);
}
}
示例13: _construct
public function _construct()
{
parent::_construct();
$brand = $this->_brand;
$group = $this->getCurrentGroup();
$brandCollection = $brand->getCollection()->addFieldToFilter('group_id', $group->getId())->addFieldToFilter('status', 1)->setOrder('position', 'ASC');
$this->setCollection($brandCollection);
$template = 'group\\view.phtml';
if (!$this->hasData('template')) {
$this->setTemplate($template);
}
}
示例14: _construct
/**
* Class constructor
*
* @return void
*/
protected function _construct()
{
parent::_construct();
$purchased = $this->_linksFactory->create()->addFieldToFilter('customer_id', $this->currentCustomer->getCustomerId())->addOrder('created_at', 'desc');
$this->setPurchased($purchased);
$purchasedIds = [];
foreach ($purchased as $_item) {
$purchasedIds[] = $_item->getId();
}
if (empty($purchasedIds)) {
$purchasedIds = [null];
}
$purchasedItems = $this->_itemsFactory->create()->addFieldToFilter('purchased_id', ['in' => $purchasedIds])->addFieldToFilter('status', ['nin' => [Item::LINK_STATUS_PENDING_PAYMENT, Item::LINK_STATUS_PAYMENT_REVIEW]])->setOrder('item_id', 'desc');
$this->setItems($purchasedItems);
}
示例15: _construct
public function _construct()
{
if (!$this->getConfig('general_settings/enable') || !$this->getConfig('brand_block/enable')) {
return;
}
parent::_construct();
$carousel_layout = $this->getConfig('brand_block/carousel_layout');
$template = '';
if ($carousel_layout == 'owl_carousel') {
$template = 'block/brand_list_owl.phtml';
} else {
$template = 'block/brand_list_bootstrap.phtml';
}
if (!$this->getTemplate() && $template != '') {
$this->setTemplate($template);
}
}