Skip to content

Commit

Permalink
Creación de lista UIComponent en administrador de Magento P 2/3
Browse files Browse the repository at this point in the history
Agregamos accion de boton (Add a new contact), por ahora solo redirecciona a controlador e imprime  TEST ADD

1.-  Nos aseguramos que se tenga agregado el item name=button en :
	app/code/Pfay/Contacts/view/adminhtml/ui_component/contacts_test_listing.xml
	la etiqueta url (*/*) indica que redirigiremos a la acción Agregar de la misma carpeta que nuestra Acción actual

2.- Creamos controlador para esta acción :
	app/code/Pfay/Contacts/Controller/Adminhtml/Test/Add.php

3.- actualízamos , compilamos y asignamos permisos
	php bin/magento setup:upgrade
	php bin/magento setup:di:compile
	chmod -R 777 var/ pub/
  • Loading branch information
PerezContrerasLuis committed Jan 21, 2022
1 parent f00f26c commit 076501b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
11 changes: 11 additions & 0 deletions code/Pfay/Contacts/Controller/Adminhtml/Test/Add.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php
namespace Pfay\Contacts\Controller\Adminhtml\Test;
use Magento\Backend\App\Action;

class Add extends \Magento\Backend\App\Action
{
public function execute()
{
die('test add');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@
<item name="buttons" xsi:type="array">
<item name="add" xsi:type="array">
<item name="name" xsi:type="string">add</item>
<item name="label" xsi:type="string" translate="true">Add a new Contact</item>
<item name="label" xsi:type="string" translate="true">Add a new contact</item>
<item name="class" xsi:type="string">primary</item>
<item name="url" xsi:type="string">*/*/newAction</item>
<item name="url" xsi:type="string">*/*/add</item>
</item>
</item>

</argument>

<!-- define the date source (must be the same than in argument/item/provider and argument/js_config/deps -->
Expand Down

0 comments on commit 076501b

Please sign in to comment.