Magento 2 - ifconfig in layout xmlHow to unset block from container in Magento 2?Move element XML not working...

Giving a talk in my old university, how prominently should I tell students my salary?

Align equations with text before one of them

Are angels creatures (Mark 16:15) and can they repent (Rev 2:5 and Rom 8:21)

Should we avoid writing fiction about historical events without extensive research?

Why are special aircraft used for the carriers in the United States Navy?

If nine coins are tossed, what is the probability that the number of heads is even?

What does it mean when I add a new variable to my linear model and the R^2 stays the same?

Can a Mimic (container form) actually hold loot?

Split a number into equal parts given the number of parts

Preparing as much as possible of a cake in advance

Is there a way to find out the age of climbing ropes?

Can a space-faring robot still function over a billion years?

Quitting employee has privileged access to critical information

Is every open circuit a capacitor?

Affine transformation of circular arc in 3D

The need of reserving one's ability in job interviews

Does the in-code argument passing conventions used on PDP-11's have a name?

Do natural melee weapons (from racial traits) trigger Improved Divine Smite?

Why is there an extra space when I type "ls" on the Desktop?

I can't die. Who am I?

Why would the IRS ask for birth certificates or even audit a small tax return?

Why can't we use freedom of speech and expression to incite people to rebel against government in India?

What is better: yes / no radio, or simple checkbox?

How can friction do no work in case of pure rolling?



Magento 2 - ifconfig in layout xml


How to unset block from container in Magento 2?Move element XML not working (Magento 2)How to extend layout in Custom moduleMagento 2 : Move “catalog.product.related” block in product viewMagento 2.1 position in layout XML changes position in generated HTMLHow to change block order in layout xmlHow to call module block after header?Move the “action nav-toggle” block into the “header.panel” on Magento 2Magento 2 | Add NOINDEX, NOFOLLOW to CMS page using Layout Update XMLMagento 2 Knockout XML->PHTML->JS->HTMLMagento 2 Add CMS/phtml block bottom before product_list_toolbar and after product_list (Between)













15















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?










share|improve this question

























  • 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
















15















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?










share|improve this question

























  • 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














15












15








15


5






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?










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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



















  • 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










1 Answer
1






active

oldest

votes


















5














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.






share|improve this answer


























  • 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













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
});


}
});














draft saved

draft discarded


















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









5














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.






share|improve this answer


























  • 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


















5














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.






share|improve this answer


























  • 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
















5












5








5







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.






share|improve this answer















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.







share|improve this answer














share|improve this answer



share|improve this answer








edited 13 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





















  • 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




















draft saved

draft discarded




















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

迭戈·戈丁...

A phrase ”follow into" in a context The 2019 Stack Overflow Developer Survey Results Are...

1960s short story making fun of James Bond-style spy fiction The 2019 Stack Overflow Developer...