How can I change an existing modal in Magento 2?Magento 2.1 adding new component type problemMagento 2.1 : Try to load a listing component for a custom model on the product edit pageHow to close a modal in Magento 2Change button text in modal popup minicartMagento2 add new field in bundle item (in option selection)DynamicRows - underscore's function last() is not definedMagento 2 declaring modifier PHP Fatal Error: null given in $modifiersMissing required argument $modifiers of MagentoUiDataProviderModifierPoolGrid action column custom callback with multiple params in magento2

What's the point of deactivating Num Lock on login screens?

Why is it a bad idea to hire a hitman to eliminate most corrupt politicians?

RG-213 Cable with electric strained wire as metallic shield of Coaxial cable

I'm flying to France today and my passport expires in less than 2 months

How to take photos in burst mode, without vibration?

What mechanic is there to disable a threat instead of killing it?

90's TV series where a boy goes to another dimension through portal near power lines

Can I use a neutral wire from another outlet to repair a broken neutral?

How can I prevent hyper evolved versions of regular creatures from wiping out their cousins?

Western buddy movie with a supernatural twist where a woman turns into an eagle at the end

Should I tell management that I intend to leave due to bad software development practices?

Where does SFDX store details about scratch orgs?

Is it unprofessional to ask if a job posting on GlassDoor is real?

Why are electrically insulating heatsinks so rare? Is it just cost?

Is "remove commented out code" correct English?

What is going on with Captain Marvel's blood colour?

Forgetting the musical notes while performing in concert

In Romance of the Three Kingdoms why do people still use bamboo sticks when papers are already invented?

Facing a paradox: Earnshaw's theorem in one dimension

Why can't we play rap on piano?

How could indestructible materials be used in power generation?

Fully-Firstable Anagram Sets

Does casting Light, or a similar spell, have any effect when the caster is swallowed by a monster?

What does it mean to describe someone as a butt steak?



How can I change an existing modal in Magento 2?


Magento 2.1 adding new component type problemMagento 2.1 : Try to load a listing component for a custom model on the product edit pageHow to close a modal in Magento 2Change button text in modal popup minicartMagento2 add new field in bundle item (in option selection)DynamicRows - underscore's function last() is not definedMagento 2 declaring modifier PHP Fatal Error: null given in $modifiersMissing required argument $modifiers of MagentoUiDataProviderModifierPoolGrid action column custom callback with multiple params in magento2






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








34















I'm trying to change the behaviour of a Modal (not Model) in Magento 2.

The modal in question is advanced_inventory_modal, declared in module-catalog-inventory/view/adminhtml/ui_component/product_form.xml.



Now I know I can use a Modifier in the product-form-modifier-pool:



<virtualType name="MagentoCatalogUiDataProviderProductFormModifierPool">
<arguments>
<argument name="modifiers" xsi:type="array">
<item name="hf_quantity" xsi:type="array">
<item name="class" xsi:type="string">VendorModuleUiDataProviderProductFormModifierQuantity</item>
<item name="sortOrder" xsi:type="number">100</item>
</item>
</argument>
</arguments>
</virtualType>


... and use the modifyMeta()-method in my modifier to manipulate the XML configuration, but for some reason, the inventory modal is not present in the data that is provided here. It's also not a sortOrder-related problem, since I already set that way high. The sortOrder-attribute might have something to do with it.



So what gives? Can anyone tell me what's the proper way to modify the content of an existing modal in Magento 2?



Edit:



I found a solution or workaround (not sure yet) on how to achieve what I am trying to achieve. It turns out that if I set sortOrder to 10000 I have some data in my modifyMeta()-method that I can use:



public function modifyMeta(array $meta)

if ($path = $this->arrayManager->findPath('quantity_and_stock_status_qty', $meta, null, 'children'))
$this->arrayManager->remove(
$path . '/children/qty/arguments/data/config/validation/validate-digits',
$meta
);


if ($path = $this->arrayManager->findPath('advanced_inventory_modal', $meta))
$meta = $this->arrayManager->merge(
$path . '/children/stock_data/children/qty/arguments/data/config',
$meta,
['validation' => ['validate-digits' => false]]
);


return $meta;




Note that the `advanced_inventory_modal` node is not yet complete, but my best guess is that the later addition of the modal merges with these settings, but doesn't override it. Could be wrong though, perhaps someone could share some more light on how this mechanism works?









share|improve this question



















  • 1





    That's the only way so far to customise kind of Ui component like this. The PHP modifiers.

    – Toan Nguyen
    Jul 18 '17 at 4:24






  • 2





    @Giel Berkers Your question is good but unfortunately I don't know how to answer it. Fortunately I have enough reputations to place bounty on your question to attract someone who knows to answer your question. My kind.

    – Farewell Stack Exchange
    Sep 4 '17 at 22:34

















34















I'm trying to change the behaviour of a Modal (not Model) in Magento 2.

The modal in question is advanced_inventory_modal, declared in module-catalog-inventory/view/adminhtml/ui_component/product_form.xml.



Now I know I can use a Modifier in the product-form-modifier-pool:



<virtualType name="MagentoCatalogUiDataProviderProductFormModifierPool">
<arguments>
<argument name="modifiers" xsi:type="array">
<item name="hf_quantity" xsi:type="array">
<item name="class" xsi:type="string">VendorModuleUiDataProviderProductFormModifierQuantity</item>
<item name="sortOrder" xsi:type="number">100</item>
</item>
</argument>
</arguments>
</virtualType>


... and use the modifyMeta()-method in my modifier to manipulate the XML configuration, but for some reason, the inventory modal is not present in the data that is provided here. It's also not a sortOrder-related problem, since I already set that way high. The sortOrder-attribute might have something to do with it.



So what gives? Can anyone tell me what's the proper way to modify the content of an existing modal in Magento 2?



Edit:



I found a solution or workaround (not sure yet) on how to achieve what I am trying to achieve. It turns out that if I set sortOrder to 10000 I have some data in my modifyMeta()-method that I can use:



public function modifyMeta(array $meta)

if ($path = $this->arrayManager->findPath('quantity_and_stock_status_qty', $meta, null, 'children'))
$this->arrayManager->remove(
$path . '/children/qty/arguments/data/config/validation/validate-digits',
$meta
);


if ($path = $this->arrayManager->findPath('advanced_inventory_modal', $meta))
$meta = $this->arrayManager->merge(
$path . '/children/stock_data/children/qty/arguments/data/config',
$meta,
['validation' => ['validate-digits' => false]]
);


return $meta;




Note that the `advanced_inventory_modal` node is not yet complete, but my best guess is that the later addition of the modal merges with these settings, but doesn't override it. Could be wrong though, perhaps someone could share some more light on how this mechanism works?









share|improve this question



















  • 1





    That's the only way so far to customise kind of Ui component like this. The PHP modifiers.

    – Toan Nguyen
    Jul 18 '17 at 4:24






  • 2





    @Giel Berkers Your question is good but unfortunately I don't know how to answer it. Fortunately I have enough reputations to place bounty on your question to attract someone who knows to answer your question. My kind.

    – Farewell Stack Exchange
    Sep 4 '17 at 22:34













34












34








34


8






I'm trying to change the behaviour of a Modal (not Model) in Magento 2.

The modal in question is advanced_inventory_modal, declared in module-catalog-inventory/view/adminhtml/ui_component/product_form.xml.



Now I know I can use a Modifier in the product-form-modifier-pool:



<virtualType name="MagentoCatalogUiDataProviderProductFormModifierPool">
<arguments>
<argument name="modifiers" xsi:type="array">
<item name="hf_quantity" xsi:type="array">
<item name="class" xsi:type="string">VendorModuleUiDataProviderProductFormModifierQuantity</item>
<item name="sortOrder" xsi:type="number">100</item>
</item>
</argument>
</arguments>
</virtualType>


... and use the modifyMeta()-method in my modifier to manipulate the XML configuration, but for some reason, the inventory modal is not present in the data that is provided here. It's also not a sortOrder-related problem, since I already set that way high. The sortOrder-attribute might have something to do with it.



So what gives? Can anyone tell me what's the proper way to modify the content of an existing modal in Magento 2?



Edit:



I found a solution or workaround (not sure yet) on how to achieve what I am trying to achieve. It turns out that if I set sortOrder to 10000 I have some data in my modifyMeta()-method that I can use:



public function modifyMeta(array $meta)

if ($path = $this->arrayManager->findPath('quantity_and_stock_status_qty', $meta, null, 'children'))
$this->arrayManager->remove(
$path . '/children/qty/arguments/data/config/validation/validate-digits',
$meta
);


if ($path = $this->arrayManager->findPath('advanced_inventory_modal', $meta))
$meta = $this->arrayManager->merge(
$path . '/children/stock_data/children/qty/arguments/data/config',
$meta,
['validation' => ['validate-digits' => false]]
);


return $meta;




Note that the `advanced_inventory_modal` node is not yet complete, but my best guess is that the later addition of the modal merges with these settings, but doesn't override it. Could be wrong though, perhaps someone could share some more light on how this mechanism works?









share|improve this question
















I'm trying to change the behaviour of a Modal (not Model) in Magento 2.

The modal in question is advanced_inventory_modal, declared in module-catalog-inventory/view/adminhtml/ui_component/product_form.xml.



Now I know I can use a Modifier in the product-form-modifier-pool:



<virtualType name="MagentoCatalogUiDataProviderProductFormModifierPool">
<arguments>
<argument name="modifiers" xsi:type="array">
<item name="hf_quantity" xsi:type="array">
<item name="class" xsi:type="string">VendorModuleUiDataProviderProductFormModifierQuantity</item>
<item name="sortOrder" xsi:type="number">100</item>
</item>
</argument>
</arguments>
</virtualType>


... and use the modifyMeta()-method in my modifier to manipulate the XML configuration, but for some reason, the inventory modal is not present in the data that is provided here. It's also not a sortOrder-related problem, since I already set that way high. The sortOrder-attribute might have something to do with it.



So what gives? Can anyone tell me what's the proper way to modify the content of an existing modal in Magento 2?



Edit:



I found a solution or workaround (not sure yet) on how to achieve what I am trying to achieve. It turns out that if I set sortOrder to 10000 I have some data in my modifyMeta()-method that I can use:



public function modifyMeta(array $meta)

if ($path = $this->arrayManager->findPath('quantity_and_stock_status_qty', $meta, null, 'children'))
$this->arrayManager->remove(
$path . '/children/qty/arguments/data/config/validation/validate-digits',
$meta
);


if ($path = $this->arrayManager->findPath('advanced_inventory_modal', $meta))
$meta = $this->arrayManager->merge(
$path . '/children/stock_data/children/qty/arguments/data/config',
$meta,
['validation' => ['validate-digits' => false]]
);


return $meta;




Note that the `advanced_inventory_modal` node is not yet complete, but my best guess is that the later addition of the modal merges with these settings, but doesn't override it. Could be wrong though, perhaps someone could share some more light on how this mechanism works?






magento2 modal






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 12 at 10:45









magefms

2,3772426




2,3772426










asked Nov 11 '16 at 12:45









Giel BerkersGiel Berkers

7,11924281




7,11924281







  • 1





    That's the only way so far to customise kind of Ui component like this. The PHP modifiers.

    – Toan Nguyen
    Jul 18 '17 at 4:24






  • 2





    @Giel Berkers Your question is good but unfortunately I don't know how to answer it. Fortunately I have enough reputations to place bounty on your question to attract someone who knows to answer your question. My kind.

    – Farewell Stack Exchange
    Sep 4 '17 at 22:34












  • 1





    That's the only way so far to customise kind of Ui component like this. The PHP modifiers.

    – Toan Nguyen
    Jul 18 '17 at 4:24






  • 2





    @Giel Berkers Your question is good but unfortunately I don't know how to answer it. Fortunately I have enough reputations to place bounty on your question to attract someone who knows to answer your question. My kind.

    – Farewell Stack Exchange
    Sep 4 '17 at 22:34







1




1





That's the only way so far to customise kind of Ui component like this. The PHP modifiers.

– Toan Nguyen
Jul 18 '17 at 4:24





That's the only way so far to customise kind of Ui component like this. The PHP modifiers.

– Toan Nguyen
Jul 18 '17 at 4:24




2




2





@Giel Berkers Your question is good but unfortunately I don't know how to answer it. Fortunately I have enough reputations to place bounty on your question to attract someone who knows to answer your question. My kind.

– Farewell Stack Exchange
Sep 4 '17 at 22:34





@Giel Berkers Your question is good but unfortunately I don't know how to answer it. Fortunately I have enough reputations to place bounty on your question to attract someone who knows to answer your question. My kind.

– Farewell Stack Exchange
Sep 4 '17 at 22:34










2 Answers
2






active

oldest

votes


















0














You can set <sequence> in module.xml of CatalogInventory module. After that, you can create product_form.xml under




app/code/Your/Module/view/adminhtml/ui_component/product_form.xml




With the same path as it is in the CatalogInventory. This will replace the configuration you needed.



I would like to provide any examples but I don't know what you need here.
P.S. you don't need to add other elements you don't need in your XML. they will be taken from parent xml configuration.






share|improve this answer
































    0














    There is a two way:



    1) Create a new Model(through new module creation in local pool)



    2) To override the existing Model of specific module which you want.






    share|improve this answer

























      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%2f145338%2fhow-can-i-change-an-existing-modal-in-magento-2%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0














      You can set <sequence> in module.xml of CatalogInventory module. After that, you can create product_form.xml under




      app/code/Your/Module/view/adminhtml/ui_component/product_form.xml




      With the same path as it is in the CatalogInventory. This will replace the configuration you needed.



      I would like to provide any examples but I don't know what you need here.
      P.S. you don't need to add other elements you don't need in your XML. they will be taken from parent xml configuration.






      share|improve this answer





























        0














        You can set <sequence> in module.xml of CatalogInventory module. After that, you can create product_form.xml under




        app/code/Your/Module/view/adminhtml/ui_component/product_form.xml




        With the same path as it is in the CatalogInventory. This will replace the configuration you needed.



        I would like to provide any examples but I don't know what you need here.
        P.S. you don't need to add other elements you don't need in your XML. they will be taken from parent xml configuration.






        share|improve this answer



























          0












          0








          0







          You can set <sequence> in module.xml of CatalogInventory module. After that, you can create product_form.xml under




          app/code/Your/Module/view/adminhtml/ui_component/product_form.xml




          With the same path as it is in the CatalogInventory. This will replace the configuration you needed.



          I would like to provide any examples but I don't know what you need here.
          P.S. you don't need to add other elements you don't need in your XML. they will be taken from parent xml configuration.






          share|improve this answer















          You can set <sequence> in module.xml of CatalogInventory module. After that, you can create product_form.xml under




          app/code/Your/Module/view/adminhtml/ui_component/product_form.xml




          With the same path as it is in the CatalogInventory. This will replace the configuration you needed.



          I would like to provide any examples but I don't know what you need here.
          P.S. you don't need to add other elements you don't need in your XML. they will be taken from parent xml configuration.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Dec 26 '18 at 5:11









          Chirag Patel

          2,468423




          2,468423










          answered Oct 15 '18 at 20:03









          AleksLiAleksLi

          111




          111























              0














              There is a two way:



              1) Create a new Model(through new module creation in local pool)



              2) To override the existing Model of specific module which you want.






              share|improve this answer





























                0














                There is a two way:



                1) Create a new Model(through new module creation in local pool)



                2) To override the existing Model of specific module which you want.






                share|improve this answer



























                  0












                  0








                  0







                  There is a two way:



                  1) Create a new Model(through new module creation in local pool)



                  2) To override the existing Model of specific module which you want.






                  share|improve this answer















                  There is a two way:



                  1) Create a new Model(through new module creation in local pool)



                  2) To override the existing Model of specific module which you want.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited 2 days ago









                  Ashish Viradiya

                  1,1581831




                  1,1581831










                  answered Mar 13 at 7:16









                  Naresh PrajapatiNaresh Prajapati

                  164




                  164



























                      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%2f145338%2fhow-can-i-change-an-existing-modal-in-magento-2%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

                      Sum ergo cogito? 1 nng

                      419 nièngy_Soadمي 19bal1.5o_g

                      Queiggey Chernihivv 9NnOo i Zw X QqKk LpB