當前位置: 首頁>>代碼示例>>PHP>>正文


PHP LayoutInterface::getBlockSingleton方法代碼示例

本文整理匯總了PHP中Magento\Framework\View\LayoutInterface::getBlockSingleton方法的典型用法代碼示例。如果您正苦於以下問題:PHP LayoutInterface::getBlockSingleton方法的具體用法?PHP LayoutInterface::getBlockSingleton怎麽用?PHP LayoutInterface::getBlockSingleton使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Framework\View\LayoutInterface的用法示例。


在下文中一共展示了LayoutInterface::getBlockSingleton方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getValueElementRenderer

 /**
  * @return \Magento\Rule\Block\Editable
  */
 public function getValueElementRenderer()
 {
     if (strpos($this->getValueElementType(), '/') !== false) {
         return $this->_layout->getBlockSingleton($this->getValueElementType());
     }
     return $this->_layout->getBlockSingleton('Magento\\Rule\\Block\\Editable');
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:10,代碼來源:AbstractCondition.php

示例2: getRssData

 /**
  * Get RSS feed items
  *
  * @return array
  */
 public function getRssData()
 {
     $passDate = $this->dateTime->formatDate(mktime(0, 0, 0, date('m'), date('d') - 7));
     $newUrl = $this->rssUrlBuilder->getUrl(['_secure' => true, '_nosecret' => true, 'type' => 'new_order']);
     $title = __('New Orders');
     $data = ['title' => $title, 'description' => $title, 'link' => $newUrl, 'charset' => 'UTF-8'];
     /** @var $order \Magento\Sales\Model\Order */
     $order = $this->orderFactory->create();
     /** @var $collection \Magento\Sales\Model\ResourceModel\Order\Collection */
     $collection = $order->getResourceCollection();
     $collection->addAttributeToFilter('created_at', ['date' => true, 'from' => $passDate])->addAttributeToSort('created_at', 'desc');
     $this->eventManager->dispatch('rss_order_new_collection_select', ['collection' => $collection]);
     $detailBlock = $this->layout->getBlockSingleton('Magento\\Sales\\Block\\Adminhtml\\Order\\Details');
     foreach ($collection as $item) {
         $title = __('Order #%1 created at %2', $item->getIncrementId(), $this->localeDate->formatDate($item->getCreatedAt()));
         $url = $this->urlBuilder->getUrl('sales/order/view', ['_secure' => true, 'order_id' => $item->getId(), '_nosecret' => true]);
         $detailBlock->setOrder($item);
         $data['entries'][] = ['title' => $title, 'link' => $url, 'description' => $detailBlock->toHtml()];
     }
     return $data;
 }
開發者ID:whoople,項目名稱:magento2-testing,代碼行數:26,代碼來源:NewOrder.php

示例3: _drawPackageBlock

 /**
  * Draw packages block
  *
  * @param  \Zend_Pdf_Page $page
  * @return \Magento\Shipping\Model\Order\Pdf\Packaging
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  * @SuppressWarnings(PHPMD.NPathComplexity)
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  * @SuppressWarnings(PHPMD.UnusedLocalVariable)
  */
 protected function _drawPackageBlock(\Zend_Pdf_Page $page)
 {
     if ($this->getPackageShippingBlock()) {
         $packaging = $this->getPackageShippingBlock();
     } else {
         $packaging = $this->_layout->getBlockSingleton('Magento\\Shipping\\Block\\Adminhtml\\Order\\Packaging');
     }
     $packages = $packaging->getPackages();
     $packageNum = 1;
     foreach ($packages as $package) {
         $page->setFillColor(new \Zend_Pdf_Color_Rgb(0.93, 0.92, 0.92));
         $page->drawRectangle(25, $this->y + 15, 190, $this->y - 35);
         $page->drawRectangle(190, $this->y + 15, 350, $this->y - 35);
         $page->drawRectangle(350, $this->y + 15, 570, $this->y - 35);
         $page->setFillColor(new \Zend_Pdf_Color_GrayScale(1));
         $page->drawRectangle(520, $this->y + 15, 570, $this->y - 5);
         $page->setFillColor(new \Zend_Pdf_Color_GrayScale(0));
         $packageText = __('Package') . ' ' . $packageNum;
         $page->drawText($packageText, 525, $this->y, 'UTF-8');
         $packageNum++;
         $package = new \Magento\Framework\DataObject($package);
         $params = new \Magento\Framework\DataObject($package->getParams());
         $dimensionUnits = $this->_carrierHelper->getMeasureDimensionName($params->getDimensionUnits());
         $typeText = __('Type') . ' : ' . $packaging->getContainerTypeByCode($params->getContainer());
         $page->drawText($typeText, 35, $this->y, 'UTF-8');
         if ($params->getLength() != null) {
             $lengthText = $params->getLength() . ' ' . $dimensionUnits;
         } else {
             $lengthText = '--';
         }
         $lengthText = __('Length') . ' : ' . $lengthText;
         $page->drawText($lengthText, 200, $this->y, 'UTF-8');
         if ($params->getDeliveryConfirmation() != null) {
             $confirmationText = __('Signature Confirmation') . ' : ' . $packaging->getDeliveryConfirmationTypeByCode($params->getDeliveryConfirmation());
             $page->drawText($confirmationText, 355, $this->y, 'UTF-8');
         }
         $this->y = $this->y - 10;
         if ($packaging->displayCustomsValue() != null) {
             $customsValueText = __('Customs Value') . ' : ' . $packaging->displayPrice($params->getCustomsValue());
             $page->drawText($customsValueText, 35, $this->y, 'UTF-8');
         }
         if ($params->getWidth() != null) {
             $widthText = $params->getWidth() . ' ' . $dimensionUnits;
         } else {
             $widthText = '--';
         }
         $widthText = __('Width') . ' : ' . $widthText;
         $page->drawText($widthText, 200, $this->y, 'UTF-8');
         if ($params->getContentType() != null) {
             if ($params->getContentType() == 'OTHER') {
                 $contentsValue = $params->getContentTypeOther();
             } else {
                 $contentsValue = $packaging->getContentTypeByCode($params->getContentType());
             }
             $contentsText = __('Contents') . ' : ' . $contentsValue;
             $page->drawText($contentsText, 355, $this->y, 'UTF-8');
         }
         $this->y = $this->y - 10;
         $weightText = __('Total Weight') . ' : ' . $params->getWeight() . ' ' . $this->_carrierHelper->getMeasureWeightName($params->getWeightUnits());
         $page->drawText($weightText, 35, $this->y, 'UTF-8');
         if ($params->getHeight() != null) {
             $heightText = $params->getHeight() . ' ' . $dimensionUnits;
         } else {
             $heightText = '--';
         }
         $heightText = __('Height') . ' : ' . $heightText;
         $page->drawText($heightText, 200, $this->y, 'UTF-8');
         $this->y = $this->y - 10;
         if ($params->getSize()) {
             $sizeText = __('Size') . ' : ' . ucfirst(strtolower($params->getSize()));
             $page->drawText($sizeText, 35, $this->y, 'UTF-8');
         }
         if ($params->getGirth() != null) {
             $dimensionGirthUnits = $this->_carrierHelper->getMeasureDimensionName($params->getGirthDimensionUnits());
             $girthText = __('Girth') . ' : ' . $params->getGirth() . ' ' . $dimensionGirthUnits;
             $page->drawText($girthText, 200, $this->y, 'UTF-8');
         }
         $this->y = $this->y - 5;
         $page->setFillColor(new \Zend_Pdf_Color_GrayScale(1));
         $page->drawRectangle(25, $this->y, 570, $this->y - 30 - count($package->getItems()) * 12);
         $this->y = $this->y - 10;
         $page->setFillColor(new \Zend_Pdf_Color_GrayScale(0));
         $page->drawText(__('Items in the Package'), 30, $this->y, 'UTF-8');
         $txtIndent = 5;
         $itemCollsNumber = $packaging->displayCustomsValue() ? 5 : 4;
         $itemCollsX[0] = 30;
         //  coordinate for Product name
         $itemCollsX[1] = 250;
         // coordinate for Product name
         $itemCollsXEnd = 565;
//.........這裏部分代碼省略.........
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:101,代碼來源:Packaging.php

示例4: getValueElement

 /**
  * @return $this
  */
 public function getValueElement()
 {
     return $this->getForm()->addField('action:' . $this->getId() . ':value', 'text', ['name' => $this->elementName . '[actions][' . $this->getId() . '][value]', 'value' => $this->getValue(), 'value_name' => $this->getValueName()])->setRenderer($this->_layout->getBlockSingleton('Magento\\Rule\\Block\\Editable'));
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:7,代碼來源:AbstractAction.php


注:本文中的Magento\Framework\View\LayoutInterface::getBlockSingleton方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。