本文整理汇总了PHP中Magento\Framework\App\RequestInterface类的典型用法代码示例。如果您正苦于以下问题:PHP RequestInterface类的具体用法?PHP RequestInterface怎么用?PHP RequestInterface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RequestInterface类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: dispatch
/**
* Dispatch request
*
* @param RequestInterface $request
* @return ResponseInterface
* @throws NotFoundException
*/
public function dispatch(RequestInterface $request)
{
$this->_request = $request;
$profilerKey = 'CONTROLLER_ACTION:' . $request->getFullActionName();
$eventParameters = ['controller_action' => $this, 'request' => $request];
$this->_eventManager->dispatch('controller_action_predispatch', $eventParameters);
$this->_eventManager->dispatch('controller_action_predispatch_' . $request->getRouteName(), $eventParameters);
$this->_eventManager->dispatch('controller_action_predispatch_' . $request->getFullActionName(), $eventParameters);
\Magento\Framework\Profiler::start($profilerKey);
$result = null;
if ($request->isDispatched() && !$this->_actionFlag->get('', self::FLAG_NO_DISPATCH)) {
\Magento\Framework\Profiler::start('action_body');
$result = $this->execute();
\Magento\Framework\Profiler::start('postdispatch');
if (!$this->_actionFlag->get('', self::FLAG_NO_POST_DISPATCH)) {
$this->_eventManager->dispatch('controller_action_postdispatch_' . $request->getFullActionName(), $eventParameters);
$this->_eventManager->dispatch('controller_action_postdispatch_' . $request->getRouteName(), $eventParameters);
$this->_eventManager->dispatch('controller_action_postdispatch', $eventParameters);
}
\Magento\Framework\Profiler::stop('postdispatch');
\Magento\Framework\Profiler::stop('action_body');
}
\Magento\Framework\Profiler::stop($profilerKey);
return $result ?: $this->_response;
}
开发者ID:shabbirvividads,项目名称:magento2,代码行数:32,代码来源:Action.php
示例2: match
/**
* Validate and Match
*
* @param \Magento\Framework\App\RequestInterface $request
* @return bool
*/
public function match(\Magento\Framework\App\RequestInterface $request)
{
/*
* We will search “examplerouter” and “exampletocms” words and make forward depend on word
* -examplerouter will forward to base router to match inchootest front name, test controller path and test controller class
* -exampletocms will set front name to cms, controller path to page and action to view
*/
$identifier = explode('/', trim($request->getPathInfo(), '/'));
if (strpos($identifier[0], 'brands') !== false && isset($identifier[1])) {
/*
* We must set module, controller path and action name + we will set page id 5 witch is about us page on
* default magento 2 installation with sample data.
*/
$id = $this->_brandFactory->create()->getCollection()->addFieldToSelect('id')->addFieldToFilter('url_key', ['eq' => $identifier[1]])->addFieldToFilter('is_active', \Emizentech\ShopByBrand\Model\Status::STATUS_ENABLED)->getFirstItem()->getId();
if ($id) {
$request->setModuleName('brand')->setControllerName('view')->setActionName('index')->setParam('id', $id);
} else {
return;
}
} else {
if (strpos($identifier[0], 'brands') !== false) {
/*
* We must set module, controller path and action name for our controller class(Controller/Test/Test.php)
*/
$request->setModuleName('brand')->setControllerName('index')->setActionName('index');
} else {
//There is no match
return;
}
}
/*
* We have match and now we will forward action
*/
return $this->actionFactory->create('Magento\\Framework\\App\\Action\\Forward', ['request' => $request]);
}
开发者ID:Doability,项目名称:magento2dev,代码行数:41,代码来源:Router.php
示例3: dispatch
/**
* Check if current section is found and is allowed
*
* @param \Magento\Framework\App\RequestInterface $request
* @return \Magento\Framework\App\ResponseInterface
*/
public function dispatch(\Magento\Framework\App\RequestInterface $request)
{
if (!$request->getParam('section')) {
$request->setParam('section', $this->_configStructure->getFirstSection()->getId());
}
return parent::dispatch($request);
}
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:13,代码来源:AbstractConfig.php
示例4: __construct
/**
* @param string $name
* @param string $primaryFieldName
* @param string $requestFieldName
* @param CollectionFactory $collectionFactory
* @param RequestInterface $request
* @param array $meta
* @param array $data
*/
public function __construct($name, $primaryFieldName, $requestFieldName, CollectionFactory $collectionFactory, RequestInterface $request, array $meta = [], array $data = [])
{
parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data);
$this->request = $request;
$this->collection = $collectionFactory->create();
$this->collection->setExcludeSetFilter((int) $this->request->getParam('template_id', 0));
}
开发者ID:Doability,项目名称:magento2dev,代码行数:16,代码来源:Listing.php
示例5: _validateProductVariations
/**
* Product variations attributes validation
*
* @param Product $parentProduct
* @param array $products
* @param RequestInterface $request
* @return array
*/
protected function _validateProductVariations(Product $parentProduct, array $products, RequestInterface $request)
{
$this->eventManager->dispatch('catalog_product_validate_variations_before', ['product' => $parentProduct, 'variations' => $products]);
$validationResult = [];
foreach ($products as $productData) {
$product = $this->productFactory->create();
$product->setData('_edit_mode', true);
$storeId = $request->getParam('store');
if ($storeId) {
$product->setStoreId($storeId);
}
$product->setAttributeSetId($parentProduct->getAttributeSetId());
$product->addData($this->getRequiredDataFromProduct($parentProduct));
$product->addData($productData);
$product->setCollectExceptionMessages(true);
$configurableAttribute = [];
$encodedData = $productData['configurable_attribute'];
if ($encodedData) {
$configurableAttribute = $this->jsonHelper->jsonDecode($encodedData);
}
$configurableAttribute = implode('-', $configurableAttribute);
$errorAttributes = $product->validate();
if (is_array($errorAttributes)) {
foreach ($errorAttributes as $attributeCode => $result) {
if (is_string($result)) {
$key = 'variations-matrix-' . $configurableAttribute . '-' . $attributeCode;
$validationResult[$key] = $result;
}
}
}
}
return $validationResult;
}
开发者ID:tingyeeh,项目名称:magento2,代码行数:41,代码来源:Plugin.php
示例6: aroundDispatch
/**
* Call method around dispatch frontend action
*
* @param FrontControllerInterface $subject
* @param \Closure $proceed
* @param RequestInterface $request
* @return $this
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* @SuppressWarnings(PHPMD)
*/
public function aroundDispatch(FrontControllerInterface $subject, \Closure $proceed, RequestInterface $request)
{
$startTime = microtime(true);
if (isset($_SERVER['REQUEST_TIME_FLOAT'])) {
$startTime = $_SERVER['REQUEST_TIME_FLOAT'];
}
/** @var \Magento\Framework\App\Request\Http $request */
if (strpos($request->getOriginalPathInfo(), 'searchautocomplete/ajax/suggest') !== false) {
$this->result->init();
$proceed($request);
#require for init translations
$request->setControllerModule('Magento_CatalogSearch');
$request->setDispatched(true);
$identifier = 'QUERY_' . $this->storeManager->getStore()->getId() . '_' . md5($request->getParam('q'));
if ($result = $this->cache->load($identifier)) {
$result = \Zend_Json::decode($result);
$result['time'] = round(microtime(true) - $startTime, 4);
$result['cache'] = true;
$data = \Zend_Json::encode($result);
} else {
// mirasvit core event
$this->eventManager->dispatch('core_register_urlrewrite');
$result = $this->result->toArray();
$result['success'] = true;
$result['time'] = round(microtime(true) - $startTime, 4);
$result['cache'] = false;
$data = \Zend_Json::encode($result);
$this->cache->save($data, $identifier, [\Magento\PageCache\Model\Cache\Type::CACHE_TAG]);
}
$this->response->setPublicHeaders(3600);
return $this->response->representJson($data);
} else {
return $proceed($request);
}
}
开发者ID:Doability,项目名称:magento2dev,代码行数:45,代码来源:Plugin.php
示例7: beforeExecute
/**
* @param Attribute\Save $subject
* @param RequestInterface $request
* @return array
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function beforeExecute(Attribute\Save $subject, RequestInterface $request)
{
$data = $request->getPostValue();
if (isset($data['frontend_input'])) {
switch ($data['frontend_input']) {
case 'swatch_visual':
$data[Swatch::SWATCH_INPUT_TYPE_KEY] = Swatch::SWATCH_INPUT_TYPE_VISUAL;
$data['frontend_input'] = 'select';
$request->setPostValue($data);
break;
case 'swatch_text':
$data[Swatch::SWATCH_INPUT_TYPE_KEY] = Swatch::SWATCH_INPUT_TYPE_TEXT;
$data['use_product_image_for_swatch'] = 0;
$data['frontend_input'] = 'select';
$request->setPostValue($data);
break;
case 'select':
$data[Swatch::SWATCH_INPUT_TYPE_KEY] = Swatch::SWATCH_INPUT_TYPE_DROPDOWN;
$data['frontend_input'] = 'select';
$request->setPostValue($data);
break;
}
}
return [$request];
}
开发者ID:nblair,项目名称:magescotch,代码行数:31,代码来源:Save.php
示例8: match
/**
* Validate and Match News Author and modify request
* @param \Magento\Framework\App\RequestInterface $request
* @return bool
* //TODO: maybe remove this and use the url rewrite table.
*/
public function match(\Magento\Framework\App\RequestInterface $request)
{
if (!$this->dispatched) {
$ipModel = $this->_ipFactory->create();
$ipCollection = $ipModel->getCollection();
$ip = $_SERVER['REMOTE_ADDR'];
// echo $ip;die;
$whitelists = $ipCollection->addFieldToFilter('member_access', 1)->addFieldToFilter('ip_address', $ip);
//Get Ip exist in whitelist
$arrayfilter = array_filter($whitelists->getData());
// Remove all empty values
if (empty($arrayfilter)) {
// check whether an array is empty or not
//echo "hello";die;
//foreach($whitelists as $ip){
//$whiteips[]=$ip->getIpAddress();
//}
//if (!in_array($ip, $whiteips)){
$identifier = trim($request->getPathInfo(), '/');
//echo $identifier;die;
// echo "wecome";die;
//echo $ip;die;
//if($ip=='172.17.0.1'){
//$request->setModuleName('firewall')->setControllerName('ipblock')->setActionName('ipblock');
$request->setModuleName('cms')->setControllerName('page')->setActionName('view')->setParam('page_id', 1);
$request->setDispatched(true);
$this->dispatched = true;
return $this->actionFactory->create('Magento\\Framework\\App\\Action\\Forward', ['request' => $request]);
//}
}
return null;
}
return null;
}
开发者ID:DRAJI,项目名称:Rapidmage,代码行数:40,代码来源:Router.php
示例9: setUp
protected function setUp()
{
$this->_session = $this->getMock('Magento\\Customer\\Model\\Session', [], [], '', false);
$this->_agreement = $this->getMock('Magento\\Paypal\\Model\\Billing\\Agreement', ['load', 'getId', 'getCustomerId', 'getReferenceId', 'canCancel', 'cancel', '__wakeup'], [], '', false);
$this->_agreement->expects($this->once())->method('load')->with(15)->will($this->returnSelf());
$this->_agreement->expects($this->once())->method('getId')->will($this->returnValue(15));
$this->_agreement->expects($this->once())->method('getCustomerId')->will($this->returnValue(871));
$this->_objectManager = $this->getMock('Magento\\Framework\\ObjectManagerInterface');
$this->_objectManager->expects($this->atLeastOnce())->method('get')->will($this->returnValueMap([['Magento\\Customer\\Model\\Session', $this->_session]]));
$this->_objectManager->expects($this->once())->method('create')->with('Magento\\Paypal\\Model\\Billing\\Agreement')->will($this->returnValue($this->_agreement));
$this->_request = $this->getMock('Magento\\Framework\\App\\RequestInterface');
$this->_request->expects($this->once())->method('getParam')->with('agreement')->will($this->returnValue(15));
$response = $this->getMock('Magento\\Framework\\App\\ResponseInterface');
$redirect = $this->getMock('Magento\\Framework\\App\\Response\\RedirectInterface');
$this->_messageManager = $this->getMock('Magento\\Framework\\Message\\ManagerInterface');
$context = $this->getMock('Magento\\Framework\\App\\Action\\Context', [], [], '', false);
$context->expects($this->any())->method('getObjectManager')->will($this->returnValue($this->_objectManager));
$context->expects($this->any())->method('getRequest')->will($this->returnValue($this->_request));
$context->expects($this->any())->method('getResponse')->will($this->returnValue($response));
$context->expects($this->any())->method('getRedirect')->will($this->returnValue($redirect));
$context->expects($this->any())->method('getMessageManager')->will($this->returnValue($this->_messageManager));
$this->_registry = $this->getMock('Magento\\Framework\\Registry', [], [], '', false);
$title = $this->getMock('Magento\\Framework\\App\\Action\\Title', [], [], '', false);
$this->_controller = new \Magento\Paypal\Controller\Billing\Agreement\Cancel($context, $this->_registry, $title);
}
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:25,代码来源:CancelTest.php
示例10: create
/**
* @param \Magento\Sales\Model\Order\Shipment $shipment
* @param RequestInterface $request
* @return void
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function create(\Magento\Sales\Model\Order\Shipment $shipment, RequestInterface $request)
{
$order = $shipment->getOrder();
$carrier = $this->carrierFactory->create($order->getShippingMethod(true)->getCarrierCode());
if (!$carrier->isShippingLabelsAvailable()) {
throw new \Magento\Framework\Exception\LocalizedException(__('Shipping labels is not available.'));
}
$shipment->setPackages($request->getParam('packages'));
$response = $this->labelFactory->create()->requestToShipment($shipment);
if ($response->hasErrors()) {
throw new \Magento\Framework\Exception\LocalizedException(__($response->getErrors()));
}
if (!$response->hasInfo()) {
throw new \Magento\Framework\Exception\LocalizedException(__('Response info is not exist.'));
}
$labelsContent = [];
$trackingNumbers = [];
$info = $response->getInfo();
foreach ($info as $inf) {
if (!empty($inf['tracking_number']) && !empty($inf['label_content'])) {
$labelsContent[] = $inf['label_content'];
$trackingNumbers[] = $inf['tracking_number'];
}
}
$outputPdf = $this->combineLabelsPdf($labelsContent);
$shipment->setShippingLabel($outputPdf->render());
$carrierCode = $carrier->getCarrierCode();
$carrierTitle = $this->scopeConfig->getValue('carriers/' . $carrierCode . '/title', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $shipment->getStoreId());
if (!empty($trackingNumbers)) {
$this->addTrackingNumbersToShipment($shipment, $trackingNumbers, $carrierCode, $carrierTitle);
}
}
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:38,代码来源:LabelGenerator.php
示例11: extract
/**
* @param string $formCode
* @param RequestInterface $request
* @return \Magento\Customer\Service\V1\Data\Customer
*/
public function extract($formCode, RequestInterface $request)
{
$customerForm = $this->formFactory->create('customer', $formCode);
$allowedAttributes = $customerForm->getAllowedAttributes();
$isGroupIdEmpty = true;
$customerData = array();
foreach ($allowedAttributes as $attribute) {
// confirmation in request param is the repeated password, not a confirmation code.
if ($attribute === 'confirmation') {
continue;
}
$attributeCode = $attribute->getAttributeCode();
if ($attributeCode == 'group_id') {
$isGroupIdEmpty = false;
}
$customerData[$attributeCode] = $request->getParam($attributeCode);
}
$this->customerBuilder->populateWithArray($customerData);
$store = $this->storeManager->getStore();
if ($isGroupIdEmpty) {
$this->customerBuilder->setGroupId($this->groupService->getDefaultGroup($store->getId())->getId());
}
$this->customerBuilder->setWebsiteId($store->getWebsiteId());
$this->customerBuilder->setStoreId($store->getId());
return $this->customerBuilder->create();
}
开发者ID:aiesh,项目名称:magento2,代码行数:31,代码来源:CustomerExtractor.php
示例12: afterGenerateXml
/**
* After generate Xml
*
* @param \Magento\Framework\View\LayoutInterface $subject
* @param \Magento\Framework\View\LayoutInterface $result
* @return \Magento\Framework\View\LayoutInterface
*/
public function afterGenerateXml(\Magento\Framework\View\LayoutInterface $subject, $result)
{
if ($this->moduleManager->isEnabled('Magento_PageCache') && $this->cacheConfig->isEnabled() && !$this->request->isAjax() && $subject->isCacheable()) {
$this->checkoutSession->clearStorage();
}
return $result;
}
开发者ID:aiesh,项目名称:magento2,代码行数:14,代码来源:DepersonalizePlugin.php
示例13: testDisplay
public function testDisplay()
{
$this->markTestSkipped('Remove it when task(MAGETWO-33495) will be fixed');
$this->_response->expects($this->atLeastOnce())->method('sendHeaders');
$this->_request->expects($this->atLeastOnce())->method('getHeader');
$stat = (include __DIR__ . '/_files/timers.php');
$this->_output->display($stat);
$actualHeaders = $this->_response->getHeaders();
$this->assertNotEmpty($actualHeaders);
$actualProtocol = false;
$actualProfilerData = false;
foreach ($actualHeaders as $oneHeader) {
$headerName = $oneHeader->getFieldName();
$headerValue = $oneHeader->getFieldValue();
if (!$actualProtocol && $headerName == 'X-Wf-Protocol-1') {
$actualProtocol = $headerValue;
}
if (!$actualProfilerData && $headerName == 'X-Wf-1-1-1-1') {
$actualProfilerData = $headerValue;
}
}
$this->assertNotEmpty($actualProtocol, 'Cannot get protocol header');
$this->assertNotEmpty($actualProfilerData, 'Cannot get profiler header');
$this->assertContains('Protocol/JsonStream', $actualProtocol);
$this->assertRegExp('/"Type":"TABLE","Label":"Code Profiler \\(Memory usage: real - \\d+, emalloc - \\d+\\)"/', $actualProfilerData);
$this->assertContains('[' . '["Timer Id","Time","Avg","Cnt","Emalloc","RealMem"],' . '["root","0.080000","0.080000","1","1,000","50,000"],' . '[". init","0.040000","0.040000","1","200","2,500"],' . '[". . init_store","0.020000","0.010000","2","100","2,000"],' . '["system","0.030000","0.015000","2","400","20,000"]' . ']', $actualProfilerData);
}
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:27,代码来源:FirebugTest.php
示例14: afterInitialize
/**
* Setting Bundle Items Data to product for further processing
*
* @param \Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper $subject
* @param \Magento\Catalog\Model\Product $product
*
* @return \Magento\Catalog\Model\Product
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
public function afterInitialize(\Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper $subject, \Magento\Catalog\Model\Product $product)
{
$compositeReadonly = $product->getCompositeReadonly();
$result['bundle_selections'] = $result['bundle_options'] = [];
if (isset($this->request->getPost('bundle_options')['bundle_options'])) {
foreach ($this->request->getPost('bundle_options')['bundle_options'] as $key => $option) {
if (empty($option['bundle_selections'])) {
continue;
}
$result['bundle_selections'][$key] = $option['bundle_selections'];
unset($option['bundle_selections']);
$result['bundle_options'][$key] = $option;
}
if ($result['bundle_selections'] && !$compositeReadonly) {
$product->setBundleSelectionsData($result['bundle_selections']);
}
if ($result['bundle_options'] && !$compositeReadonly) {
$product->setBundleOptionsData($result['bundle_options']);
}
$this->processBundleOptionsData($product);
$this->processDynamicOptionsData($product);
}
$affectProductSelections = (bool) $this->request->getPost('affect_bundle_product_selections');
$product->setCanSaveBundleSelections($affectProductSelections && !$compositeReadonly);
return $product;
}
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:37,代码来源:Bundle.php
示例15: testExecute
public function testExecute()
{
$this->request->expects($this->once())
->method('isPost')
->willReturn(true);
$this->request->expects($this->once())
->method('getParam')
->with('files')
->willReturn('{"files":"file"}');
$jsonData = $this->getMock('Magento\Framework\Json\Helper\Data', [], [], '', false);
$jsonData->expects($this->once())
->method('jsonDecode')
->with('{"files":"file"}')
->willReturn(['files' => 'file']);
$this->objectManager->expects($this->at(0))
->method('get')
->with('Magento\Framework\Json\Helper\Data')
->willReturn($jsonData);
$this->objectManager->expects($this->at(1))
->method('get')
->with('Magento\Theme\Model\Wysiwyg\Storage')
->willReturn($this->storage);
$this->storage->expects($this->once())
->method('deleteFile')
->with('file');
$this->controller->executeInternal();
}
开发者ID:nblair,项目名称:magescotch,代码行数:29,代码来源:DeleteFilesTest.php
示例16: testGetCollection
public function testGetCollection()
{
$this->collectionMock->expects($this->once())->method('addAttributeToFilter');
$this->productLinkRepositoryMock->expects($this->once())->method('getList')->willReturn([]);
$this->requestMock->expects($this->exactly(2))->method('getParam')->willReturn(1);
$this->assertInstanceOf(Collection::class, $this->getModel()->getCollection());
}
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:7,代码来源:AbstractDataProviderTest.php
示例17: testGetAction
/**
* @param bool $isSecure
* @param string $actionUrl
* @param int $productId
* @dataProvider getActionDataProvider
*/
public function testGetAction($isSecure, $actionUrl, $productId)
{
$this->urlBuilder->expects($this->any())->method('getUrl')->with('review/product/post', ['_secure' => $isSecure, 'id' => $productId])->willReturn($actionUrl . '/id/' . $productId);
$this->requestMock->expects($this->any())->method('getParam')->with('id', false)->willReturn($productId);
$this->requestMock->expects($this->any())->method('isSecure')->willReturn($isSecure);
$this->assertEquals($actionUrl . '/id/' . $productId, $this->object->getAction());
}
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:13,代码来源:FormTest.php
示例18: testGetDistroBaseUrl
/**
* @param $serverVariables array
* @param $expectedResult string
* @dataProvider serverVariablesProvider
*/
public function testGetDistroBaseUrl($serverVariables, $expectedResult)
{
$originalServerValue = $_SERVER;
$_SERVER = $serverVariables;
$this->assertEquals($expectedResult, $this->_model->getDistroBaseUrl());
$_SERVER = $originalServerValue;
}
开发者ID:Atlis,项目名称:docker-magento2,代码行数:12,代码来源:HttpTest.php
示例19: getLinks
/**
* Get stored value.
* Fallback to request if none.
*
* @return array|null
*/
public function getLinks()
{
if (null === $this->links) {
$this->links = (array) $this->request->getParam('links', []);
}
return $this->links;
}
开发者ID:Doability,项目名称:magento2dev,代码行数:13,代码来源:Resolver.php
示例20: getData
/**
* Retrieve configuration metadata
*
* @return array
*/
public function getData()
{
$scope = $this->request->getParam('scope');
$scopeId = $this->request->getParam('scope_id');
$data = [];
if ($scope) {
$showFallbackReset = false;
list($fallbackScope, $fallbackScopeId) = $this->scopeFallbackResolver->getFallbackScope($scope, $scopeId);
if ($fallbackScope && !$this->storeManager->isSingleStoreMode()) {
$scope = $fallbackScope;
$scopeId = $fallbackScopeId;
$showFallbackReset = true;
}
$designConfig = $this->designConfigRepository->getByScope($scope, $scopeId);
$fieldsData = $designConfig->getExtensionAttributes()->getDesignConfigData();
foreach ($fieldsData as $fieldData) {
$element =& $data;
foreach (explode('/', $fieldData->getFieldConfig()['fieldset']) as $fieldset) {
if (!isset($element[$fieldset]['children'])) {
$element[$fieldset]['children'] = [];
}
$element =& $element[$fieldset]['children'];
}
$fieldName = $fieldData->getFieldConfig()['field'];
$element[$fieldName]['arguments']['data']['config']['default'] = $fieldData->getValue();
$element[$fieldName]['arguments']['data']['config']['showFallbackReset'] = $showFallbackReset;
}
}
return $data;
}
开发者ID:Doability,项目名称:magento2dev,代码行数:35,代码来源:MetadataLoader.php
注:本文中的Magento\Framework\App\RequestInterface类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论