Magento 2 - ifconfig in layout xml
I'm working with magento 2.
I can use ifconfig attribute in the block code, and it works well.
<block class="MagentoCatalogBlockCategoryView" name="category_desc_main_column" template="category/desc_main_column.phtml" ifconfig="config_path/group/field" before="category.products"/>
But I tried to use it for move, it didn't work.
<move element="category.image" destination="content" ifconfig="config_path/group/field" before="-"/>
Anyone know how to use it for moving?
magento2 layout xml ifconfig
add a comment |
I'm working with magento 2.
I can use ifconfig attribute in the block code, and it works well.
<block class="MagentoCatalogBlockCategoryView" name="category_desc_main_column" template="category/desc_main_column.phtml" ifconfig="config_path/group/field" before="category.products"/>
But I tried to use it for move, it didn't work.
<move element="category.image" destination="content" ifconfig="config_path/group/field" before="-"/>
Anyone know how to use it for moving?
magento2 layout xml ifconfig
Have you looked for it? I see it in the block reader, but nothing in the move one. Don't think you can.
– nevvermind
Oct 4 '15 at 20:36
Is there any other way for it without using ifconfig?
– Dmitry
Oct 5 '15 at 0:44
add a comment |
I'm working with magento 2.
I can use ifconfig attribute in the block code, and it works well.
<block class="MagentoCatalogBlockCategoryView" name="category_desc_main_column" template="category/desc_main_column.phtml" ifconfig="config_path/group/field" before="category.products"/>
But I tried to use it for move, it didn't work.
<move element="category.image" destination="content" ifconfig="config_path/group/field" before="-"/>
Anyone know how to use it for moving?
magento2 layout xml ifconfig
I'm working with magento 2.
I can use ifconfig attribute in the block code, and it works well.
<block class="MagentoCatalogBlockCategoryView" name="category_desc_main_column" template="category/desc_main_column.phtml" ifconfig="config_path/group/field" before="category.products"/>
But I tried to use it for move, it didn't work.
<move element="category.image" destination="content" ifconfig="config_path/group/field" before="-"/>
Anyone know how to use it for moving?
magento2 layout xml ifconfig
magento2 layout xml ifconfig
edited May 24 '16 at 8:24
Dmitry
asked Oct 2 '15 at 9:11
DmitryDmitry
1,02721322
1,02721322
Have you looked for it? I see it in the block reader, but nothing in the move one. Don't think you can.
– nevvermind
Oct 4 '15 at 20:36
Is there any other way for it without using ifconfig?
– Dmitry
Oct 5 '15 at 0:44
add a comment |
Have you looked for it? I see it in the block reader, but nothing in the move one. Don't think you can.
– nevvermind
Oct 4 '15 at 20:36
Is there any other way for it without using ifconfig?
– Dmitry
Oct 5 '15 at 0:44
Have you looked for it? I see it in the block reader, but nothing in the move one. Don't think you can.
– nevvermind
Oct 4 '15 at 20:36
Have you looked for it? I see it in the block reader, but nothing in the move one. Don't think you can.
– nevvermind
Oct 4 '15 at 20:36
Is there any other way for it without using ifconfig?
– Dmitry
Oct 5 '15 at 0:44
Is there any other way for it without using ifconfig?
– Dmitry
Oct 5 '15 at 0:44
add a comment |
1 Answer
1
active
oldest
votes
From what i understand you can't use ifconfig on move.
In the class MagentoFrameworkViewLayoutReaderBlock.php there is a check for the attribute ifconfig:
$configPath = (string)$currentElement->getAttribute('ifconfig');
source:
https://github.com/magento/magento2/blob/2.3-develop/lib/internal/Magento/Framework/View/Layout/Reader/Block.php
However on the move block is doesn't actually check for the ifconfig attribute:
protected function scheduleMove(LayoutScheduledStructure $scheduledStructure, LayoutElement $currentElement)
{
$elementName = (string)$currentElement->getAttribute('element');
$destination = (string)$currentElement->getAttribute('destination');
$alias = (string)$currentElement->getAttribute('as') ?: '';
if ($elementName && $destination) {
list($siblingName, $isAfter) = $this->beforeAfterToSibling($currentElement);
$scheduledStructure->setElementToMove(
$elementName,
[$destination, $siblingName, $isAfter, $alias]
);
} else {
throw new MagentoFrameworkExceptionLocalizedException(
new MagentoFrameworkPhrase('Element name and destination must be specified.')
);
}
return $this;
}
https://github.com/magento/magento2/blob/2.3-develop/lib/internal/Magento/Framework/View/Layout/Reader/Move.php#L49
In Theroy you shouldn't need the ifconfig on the move if there is already an ifconfig on the block as the block won't be rendered and thus not moved.
Hope that makes sense.
Is there any extension with strong feature of ifconfig like 1.x?
– Dmitry
May 20 '16 at 16:00
Hey @Dmitry i don't think there is or one that i'm not aware of. What do you need the ifconfig for?
– rob3000
May 23 '16 at 0:27
eg: <action method="setTemplate" ifconfig="config_path/group/field" condition="one_column"><template>page/1column.phtml</template></action> I meant "ifconfig" and "condition"
– Dmitry
May 23 '16 at 3:11
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "479"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f85032%2fmagento-2-ifconfig-in-layout-xml%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
From what i understand you can't use ifconfig on move.
In the class MagentoFrameworkViewLayoutReaderBlock.php there is a check for the attribute ifconfig:
$configPath = (string)$currentElement->getAttribute('ifconfig');
source:
https://github.com/magento/magento2/blob/2.3-develop/lib/internal/Magento/Framework/View/Layout/Reader/Block.php
However on the move block is doesn't actually check for the ifconfig attribute:
protected function scheduleMove(LayoutScheduledStructure $scheduledStructure, LayoutElement $currentElement)
{
$elementName = (string)$currentElement->getAttribute('element');
$destination = (string)$currentElement->getAttribute('destination');
$alias = (string)$currentElement->getAttribute('as') ?: '';
if ($elementName && $destination) {
list($siblingName, $isAfter) = $this->beforeAfterToSibling($currentElement);
$scheduledStructure->setElementToMove(
$elementName,
[$destination, $siblingName, $isAfter, $alias]
);
} else {
throw new MagentoFrameworkExceptionLocalizedException(
new MagentoFrameworkPhrase('Element name and destination must be specified.')
);
}
return $this;
}
https://github.com/magento/magento2/blob/2.3-develop/lib/internal/Magento/Framework/View/Layout/Reader/Move.php#L49
In Theroy you shouldn't need the ifconfig on the move if there is already an ifconfig on the block as the block won't be rendered and thus not moved.
Hope that makes sense.
Is there any extension with strong feature of ifconfig like 1.x?
– Dmitry
May 20 '16 at 16:00
Hey @Dmitry i don't think there is or one that i'm not aware of. What do you need the ifconfig for?
– rob3000
May 23 '16 at 0:27
eg: <action method="setTemplate" ifconfig="config_path/group/field" condition="one_column"><template>page/1column.phtml</template></action> I meant "ifconfig" and "condition"
– Dmitry
May 23 '16 at 3:11
add a comment |
From what i understand you can't use ifconfig on move.
In the class MagentoFrameworkViewLayoutReaderBlock.php there is a check for the attribute ifconfig:
$configPath = (string)$currentElement->getAttribute('ifconfig');
source:
https://github.com/magento/magento2/blob/2.3-develop/lib/internal/Magento/Framework/View/Layout/Reader/Block.php
However on the move block is doesn't actually check for the ifconfig attribute:
protected function scheduleMove(LayoutScheduledStructure $scheduledStructure, LayoutElement $currentElement)
{
$elementName = (string)$currentElement->getAttribute('element');
$destination = (string)$currentElement->getAttribute('destination');
$alias = (string)$currentElement->getAttribute('as') ?: '';
if ($elementName && $destination) {
list($siblingName, $isAfter) = $this->beforeAfterToSibling($currentElement);
$scheduledStructure->setElementToMove(
$elementName,
[$destination, $siblingName, $isAfter, $alias]
);
} else {
throw new MagentoFrameworkExceptionLocalizedException(
new MagentoFrameworkPhrase('Element name and destination must be specified.')
);
}
return $this;
}
https://github.com/magento/magento2/blob/2.3-develop/lib/internal/Magento/Framework/View/Layout/Reader/Move.php#L49
In Theroy you shouldn't need the ifconfig on the move if there is already an ifconfig on the block as the block won't be rendered and thus not moved.
Hope that makes sense.
Is there any extension with strong feature of ifconfig like 1.x?
– Dmitry
May 20 '16 at 16:00
Hey @Dmitry i don't think there is or one that i'm not aware of. What do you need the ifconfig for?
– rob3000
May 23 '16 at 0:27
eg: <action method="setTemplate" ifconfig="config_path/group/field" condition="one_column"><template>page/1column.phtml</template></action> I meant "ifconfig" and "condition"
– Dmitry
May 23 '16 at 3:11
add a comment |
From what i understand you can't use ifconfig on move.
In the class MagentoFrameworkViewLayoutReaderBlock.php there is a check for the attribute ifconfig:
$configPath = (string)$currentElement->getAttribute('ifconfig');
source:
https://github.com/magento/magento2/blob/2.3-develop/lib/internal/Magento/Framework/View/Layout/Reader/Block.php
However on the move block is doesn't actually check for the ifconfig attribute:
protected function scheduleMove(LayoutScheduledStructure $scheduledStructure, LayoutElement $currentElement)
{
$elementName = (string)$currentElement->getAttribute('element');
$destination = (string)$currentElement->getAttribute('destination');
$alias = (string)$currentElement->getAttribute('as') ?: '';
if ($elementName && $destination) {
list($siblingName, $isAfter) = $this->beforeAfterToSibling($currentElement);
$scheduledStructure->setElementToMove(
$elementName,
[$destination, $siblingName, $isAfter, $alias]
);
} else {
throw new MagentoFrameworkExceptionLocalizedException(
new MagentoFrameworkPhrase('Element name and destination must be specified.')
);
}
return $this;
}
https://github.com/magento/magento2/blob/2.3-develop/lib/internal/Magento/Framework/View/Layout/Reader/Move.php#L49
In Theroy you shouldn't need the ifconfig on the move if there is already an ifconfig on the block as the block won't be rendered and thus not moved.
Hope that makes sense.
From what i understand you can't use ifconfig on move.
In the class MagentoFrameworkViewLayoutReaderBlock.php there is a check for the attribute ifconfig:
$configPath = (string)$currentElement->getAttribute('ifconfig');
source:
https://github.com/magento/magento2/blob/2.3-develop/lib/internal/Magento/Framework/View/Layout/Reader/Block.php
However on the move block is doesn't actually check for the ifconfig attribute:
protected function scheduleMove(LayoutScheduledStructure $scheduledStructure, LayoutElement $currentElement)
{
$elementName = (string)$currentElement->getAttribute('element');
$destination = (string)$currentElement->getAttribute('destination');
$alias = (string)$currentElement->getAttribute('as') ?: '';
if ($elementName && $destination) {
list($siblingName, $isAfter) = $this->beforeAfterToSibling($currentElement);
$scheduledStructure->setElementToMove(
$elementName,
[$destination, $siblingName, $isAfter, $alias]
);
} else {
throw new MagentoFrameworkExceptionLocalizedException(
new MagentoFrameworkPhrase('Element name and destination must be specified.')
);
}
return $this;
}
https://github.com/magento/magento2/blob/2.3-develop/lib/internal/Magento/Framework/View/Layout/Reader/Move.php#L49
In Theroy you shouldn't need the ifconfig on the move if there is already an ifconfig on the block as the block won't be rendered and thus not moved.
Hope that makes sense.
edited 14 mins ago
Ryre
58011127
58011127
answered Nov 25 '15 at 4:26
rob3000rob3000
2,152826
2,152826
Is there any extension with strong feature of ifconfig like 1.x?
– Dmitry
May 20 '16 at 16:00
Hey @Dmitry i don't think there is or one that i'm not aware of. What do you need the ifconfig for?
– rob3000
May 23 '16 at 0:27
eg: <action method="setTemplate" ifconfig="config_path/group/field" condition="one_column"><template>page/1column.phtml</template></action> I meant "ifconfig" and "condition"
– Dmitry
May 23 '16 at 3:11
add a comment |
Is there any extension with strong feature of ifconfig like 1.x?
– Dmitry
May 20 '16 at 16:00
Hey @Dmitry i don't think there is or one that i'm not aware of. What do you need the ifconfig for?
– rob3000
May 23 '16 at 0:27
eg: <action method="setTemplate" ifconfig="config_path/group/field" condition="one_column"><template>page/1column.phtml</template></action> I meant "ifconfig" and "condition"
– Dmitry
May 23 '16 at 3:11
Is there any extension with strong feature of ifconfig like 1.x?
– Dmitry
May 20 '16 at 16:00
Is there any extension with strong feature of ifconfig like 1.x?
– Dmitry
May 20 '16 at 16:00
Hey @Dmitry i don't think there is or one that i'm not aware of. What do you need the ifconfig for?
– rob3000
May 23 '16 at 0:27
Hey @Dmitry i don't think there is or one that i'm not aware of. What do you need the ifconfig for?
– rob3000
May 23 '16 at 0:27
eg: <action method="setTemplate" ifconfig="config_path/group/field" condition="one_column"><template>page/1column.phtml</template></action> I meant "ifconfig" and "condition"
– Dmitry
May 23 '16 at 3:11
eg: <action method="setTemplate" ifconfig="config_path/group/field" condition="one_column"><template>page/1column.phtml</template></action> I meant "ifconfig" and "condition"
– Dmitry
May 23 '16 at 3:11
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f85032%2fmagento-2-ifconfig-in-layout-xml%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Have you looked for it? I see it in the block reader, but nothing in the move one. Don't think you can.
– nevvermind
Oct 4 '15 at 20:36
Is there any other way for it without using ifconfig?
– Dmitry
Oct 5 '15 at 0:44