Magento 2 WYSIWYG field in custom admin formAdmin form field buttonWYSIWYG custom stylesData population in UI formMagento 2 Add new field to Magento_User admin formMagento 2 Admin form wysiwyg field width problemCan't set value for wysiwyg field component in admin formMagento2: Dependency in admin form fieldHow Do we can give dynamic data for a form field in admin form(ui-component) in magento 2Magento 2.2.5 : Add custom field in product attribute add formI have created one field using product form field for my price i want save my field value at product creation time from backend magento2
What is temperature on a quantum level?
What to put after taking off rear stabilisers from child bicyle?
Draw 3D Cubes around centre
Can I intentionally omit previous work experience or pretend it doesn't exist when applying for jobs?
Installing ubuntu with HD + SSD
What is the German equivalent of 干物女 (dried fish woman)?
QGIS Linestring rendering curves between vertex
How to repair a laptop's screen hinges?
Construct a pentagon avoiding compass use
Can anybody provide any information about this equation?
How can I legally visit the United States Minor Outlying Islands in the Pacific?
In which ways do anagamis still experience ignorance?
Optimizing Process Builder: Early Exit: Worthwhile?
Too many spies!
Are lithium batteries allowed in the International Space Station?
Rearranging the formula
Why did the Japanese attack the Aleutians at the same time as Midway?
Why is the total number of hard disk sectors shown in fdisk not the same as theoretical calculation?
Can I play a first turn Simic Growth Chamber to have 3 mana available in the second turn?
How might the United Kingdom become a republic?
How does one stock fund's charge of 1% more in operating expenses than another fund lower expected returns by 10%?
Is a public company able to check out who owns its shares in very detailed format?
What does "Fotze" really mean?
About the number of real roots
Magento 2 WYSIWYG field in custom admin form
Admin form field buttonWYSIWYG custom stylesData population in UI formMagento 2 Add new field to Magento_User admin formMagento 2 Admin form wysiwyg field width problemCan't set value for wysiwyg field component in admin formMagento2: Dependency in admin form fieldHow Do we can give dynamic data for a form field in admin form(ui-component) in magento 2Magento 2.2.5 : Add custom field in product attribute add formI have created one field using product form field for my price i want save my field value at product creation time from backend magento2
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I'm trying to add some fiels dynamically with Ui interface in a custom admin form.
in order_ticket_form.xml
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
---
<fieldset name="message" class="BileamaraSalesOrderGridUiComponentFormFieldsetTicketMessage">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string" translate="true">Add Message in Every Language</item>
<item name="sortOrder" xsi:type="number">20</item>
</item>
</argument>
</fieldset>
</form>
and BileamaraSalesOrderGridUiComponentFormFieldsetTicketMessage
<?php
namespace BileamaraSalesOrderGridUiComponentFormFieldsetTicket;
use MagentoFrameworkViewElementUiComponentContextInterface;
use MagentoFrameworkViewElementUiComponentInterface;
use MagentoUiComponentFormFieldFactory;
use MagentoUiComponentFormFieldset as BaseFieldset;
use MagentoStoreModelSystemStore as SystemStore;
use MagentoCmsModelWysiwygConfig as WysiwygConfig;
class Message extends BaseFieldset
/**
* @var FieldFactory
*/
private $fieldFactory;
protected $systemStore;
public function __construct(
WysiwygConfig $wysiwygConfig,
SystemStore $systemStore,
ContextInterface $context,
array $components = [],
array $data = [],
FieldFactory $fieldFactory)
parent::__construct($context, $components, $data);
$this->_wysiwygConfig = $wysiwygConfig;
$this->systemStore = $systemStore;
$this->fieldFactory = $fieldFactory;
/**
* Get components
*
* @return UiComponentInterface[]
*/
public function getChildComponents()
$wysiwygConfig = $this->_wysiwygConfig->getConfig([
'hidden' => 0
]);
$storeCollection = $this->systemStore->getStoreCollection();
foreach ($storeCollection as $store)
$fields['message_'.$store->getCode()] = [
'formElement' => 'wysiwyg',
'label' => $store->getName(),
'wysiwyg' => true,
'required' => true,
'config' => $wysiwygConfig,
];
foreach ($fields as $name => $fieldConfig)
$fieldInstance = $this->fieldFactory->create();
$fieldInstance->setData(
[
'config' => $fieldConfig,
'name' => $name,
]
);
$fieldInstance->prepare();
$this->addComponent($name, $fieldInstance);
return parent::getChildComponents();
Now I got the fields
but:
- editor is hidden and should be visible
- label is missing
- there is no space betwin fields
I need to set field id different from name, somting like
- id => message_en
- name => message[en]
because i need message result in an array.
Any help?
adminform magento2.3.1 wysiwyg ui-form custom-field
add a comment |
I'm trying to add some fiels dynamically with Ui interface in a custom admin form.
in order_ticket_form.xml
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
---
<fieldset name="message" class="BileamaraSalesOrderGridUiComponentFormFieldsetTicketMessage">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string" translate="true">Add Message in Every Language</item>
<item name="sortOrder" xsi:type="number">20</item>
</item>
</argument>
</fieldset>
</form>
and BileamaraSalesOrderGridUiComponentFormFieldsetTicketMessage
<?php
namespace BileamaraSalesOrderGridUiComponentFormFieldsetTicket;
use MagentoFrameworkViewElementUiComponentContextInterface;
use MagentoFrameworkViewElementUiComponentInterface;
use MagentoUiComponentFormFieldFactory;
use MagentoUiComponentFormFieldset as BaseFieldset;
use MagentoStoreModelSystemStore as SystemStore;
use MagentoCmsModelWysiwygConfig as WysiwygConfig;
class Message extends BaseFieldset
/**
* @var FieldFactory
*/
private $fieldFactory;
protected $systemStore;
public function __construct(
WysiwygConfig $wysiwygConfig,
SystemStore $systemStore,
ContextInterface $context,
array $components = [],
array $data = [],
FieldFactory $fieldFactory)
parent::__construct($context, $components, $data);
$this->_wysiwygConfig = $wysiwygConfig;
$this->systemStore = $systemStore;
$this->fieldFactory = $fieldFactory;
/**
* Get components
*
* @return UiComponentInterface[]
*/
public function getChildComponents()
$wysiwygConfig = $this->_wysiwygConfig->getConfig([
'hidden' => 0
]);
$storeCollection = $this->systemStore->getStoreCollection();
foreach ($storeCollection as $store)
$fields['message_'.$store->getCode()] = [
'formElement' => 'wysiwyg',
'label' => $store->getName(),
'wysiwyg' => true,
'required' => true,
'config' => $wysiwygConfig,
];
foreach ($fields as $name => $fieldConfig)
$fieldInstance = $this->fieldFactory->create();
$fieldInstance->setData(
[
'config' => $fieldConfig,
'name' => $name,
]
);
$fieldInstance->prepare();
$this->addComponent($name, $fieldInstance);
return parent::getChildComponents();
Now I got the fields
but:
- editor is hidden and should be visible
- label is missing
- there is no space betwin fields
I need to set field id different from name, somting like
- id => message_en
- name => message[en]
because i need message result in an array.
Any help?
adminform magento2.3.1 wysiwyg ui-form custom-field
add a comment |
I'm trying to add some fiels dynamically with Ui interface in a custom admin form.
in order_ticket_form.xml
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
---
<fieldset name="message" class="BileamaraSalesOrderGridUiComponentFormFieldsetTicketMessage">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string" translate="true">Add Message in Every Language</item>
<item name="sortOrder" xsi:type="number">20</item>
</item>
</argument>
</fieldset>
</form>
and BileamaraSalesOrderGridUiComponentFormFieldsetTicketMessage
<?php
namespace BileamaraSalesOrderGridUiComponentFormFieldsetTicket;
use MagentoFrameworkViewElementUiComponentContextInterface;
use MagentoFrameworkViewElementUiComponentInterface;
use MagentoUiComponentFormFieldFactory;
use MagentoUiComponentFormFieldset as BaseFieldset;
use MagentoStoreModelSystemStore as SystemStore;
use MagentoCmsModelWysiwygConfig as WysiwygConfig;
class Message extends BaseFieldset
/**
* @var FieldFactory
*/
private $fieldFactory;
protected $systemStore;
public function __construct(
WysiwygConfig $wysiwygConfig,
SystemStore $systemStore,
ContextInterface $context,
array $components = [],
array $data = [],
FieldFactory $fieldFactory)
parent::__construct($context, $components, $data);
$this->_wysiwygConfig = $wysiwygConfig;
$this->systemStore = $systemStore;
$this->fieldFactory = $fieldFactory;
/**
* Get components
*
* @return UiComponentInterface[]
*/
public function getChildComponents()
$wysiwygConfig = $this->_wysiwygConfig->getConfig([
'hidden' => 0
]);
$storeCollection = $this->systemStore->getStoreCollection();
foreach ($storeCollection as $store)
$fields['message_'.$store->getCode()] = [
'formElement' => 'wysiwyg',
'label' => $store->getName(),
'wysiwyg' => true,
'required' => true,
'config' => $wysiwygConfig,
];
foreach ($fields as $name => $fieldConfig)
$fieldInstance = $this->fieldFactory->create();
$fieldInstance->setData(
[
'config' => $fieldConfig,
'name' => $name,
]
);
$fieldInstance->prepare();
$this->addComponent($name, $fieldInstance);
return parent::getChildComponents();
Now I got the fields
but:
- editor is hidden and should be visible
- label is missing
- there is no space betwin fields
I need to set field id different from name, somting like
- id => message_en
- name => message[en]
because i need message result in an array.
Any help?
adminform magento2.3.1 wysiwyg ui-form custom-field
I'm trying to add some fiels dynamically with Ui interface in a custom admin form.
in order_ticket_form.xml
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
---
<fieldset name="message" class="BileamaraSalesOrderGridUiComponentFormFieldsetTicketMessage">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string" translate="true">Add Message in Every Language</item>
<item name="sortOrder" xsi:type="number">20</item>
</item>
</argument>
</fieldset>
</form>
and BileamaraSalesOrderGridUiComponentFormFieldsetTicketMessage
<?php
namespace BileamaraSalesOrderGridUiComponentFormFieldsetTicket;
use MagentoFrameworkViewElementUiComponentContextInterface;
use MagentoFrameworkViewElementUiComponentInterface;
use MagentoUiComponentFormFieldFactory;
use MagentoUiComponentFormFieldset as BaseFieldset;
use MagentoStoreModelSystemStore as SystemStore;
use MagentoCmsModelWysiwygConfig as WysiwygConfig;
class Message extends BaseFieldset
/**
* @var FieldFactory
*/
private $fieldFactory;
protected $systemStore;
public function __construct(
WysiwygConfig $wysiwygConfig,
SystemStore $systemStore,
ContextInterface $context,
array $components = [],
array $data = [],
FieldFactory $fieldFactory)
parent::__construct($context, $components, $data);
$this->_wysiwygConfig = $wysiwygConfig;
$this->systemStore = $systemStore;
$this->fieldFactory = $fieldFactory;
/**
* Get components
*
* @return UiComponentInterface[]
*/
public function getChildComponents()
$wysiwygConfig = $this->_wysiwygConfig->getConfig([
'hidden' => 0
]);
$storeCollection = $this->systemStore->getStoreCollection();
foreach ($storeCollection as $store)
$fields['message_'.$store->getCode()] = [
'formElement' => 'wysiwyg',
'label' => $store->getName(),
'wysiwyg' => true,
'required' => true,
'config' => $wysiwygConfig,
];
foreach ($fields as $name => $fieldConfig)
$fieldInstance = $this->fieldFactory->create();
$fieldInstance->setData(
[
'config' => $fieldConfig,
'name' => $name,
]
);
$fieldInstance->prepare();
$this->addComponent($name, $fieldInstance);
return parent::getChildComponents();
Now I got the fields
but:
- editor is hidden and should be visible
- label is missing
- there is no space betwin fields
I need to set field id different from name, somting like
- id => message_en
- name => message[en]
because i need message result in an array.
Any help?
adminform magento2.3.1 wysiwyg ui-form custom-field
adminform magento2.3.1 wysiwyg ui-form custom-field
asked Jul 5 at 15:33
krybbiokrybbio
6897 silver badges22 bronze badges
6897 silver badges22 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
I needed to add 'template' => 'ui/form/field'
in field configuration so now the code is
public function getChildComponents()
$stores = $this->storeManager->getStores();
uasort(
$stores,
function (MagentoStoreModelStore $storeA, MagentoStoreModelStore $storeB)
return $storeA->getSortOrder() <=> $storeB->getSortOrder();
);
foreach ($stores as $store)
$fields['message_'.$store->getCode()] = [
'formElement' => 'wysiwyg',
'label' => $store->getName().'_'.$store->getSortOrder(),
'wysiwyg' => true,
'wysiwygConfigData' => [
'hidden' => false,
'add_widgets' => false,
'add_variables' => false,
],
'validation' => ['required-entry' => true],
'template' => 'ui/form/field'
];
foreach ($fields as $name => $fieldConfig)
$fieldInstance = $this->fieldFactory->create();
$fieldInstance->setData(
[
'config' => $fieldConfig,
'name' => $name,
]
);
$fieldInstance->prepare();
$this->addComponent($name, $fieldInstance);
return parent::getChildComponents();
Still wonder if there is any chance to group fields like address field in order form, something like message[en]
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%2f281000%2fmagento-2-wysiwyg-field-in-custom-admin-form%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
I needed to add 'template' => 'ui/form/field'
in field configuration so now the code is
public function getChildComponents()
$stores = $this->storeManager->getStores();
uasort(
$stores,
function (MagentoStoreModelStore $storeA, MagentoStoreModelStore $storeB)
return $storeA->getSortOrder() <=> $storeB->getSortOrder();
);
foreach ($stores as $store)
$fields['message_'.$store->getCode()] = [
'formElement' => 'wysiwyg',
'label' => $store->getName().'_'.$store->getSortOrder(),
'wysiwyg' => true,
'wysiwygConfigData' => [
'hidden' => false,
'add_widgets' => false,
'add_variables' => false,
],
'validation' => ['required-entry' => true],
'template' => 'ui/form/field'
];
foreach ($fields as $name => $fieldConfig)
$fieldInstance = $this->fieldFactory->create();
$fieldInstance->setData(
[
'config' => $fieldConfig,
'name' => $name,
]
);
$fieldInstance->prepare();
$this->addComponent($name, $fieldInstance);
return parent::getChildComponents();
Still wonder if there is any chance to group fields like address field in order form, something like message[en]
add a comment |
I needed to add 'template' => 'ui/form/field'
in field configuration so now the code is
public function getChildComponents()
$stores = $this->storeManager->getStores();
uasort(
$stores,
function (MagentoStoreModelStore $storeA, MagentoStoreModelStore $storeB)
return $storeA->getSortOrder() <=> $storeB->getSortOrder();
);
foreach ($stores as $store)
$fields['message_'.$store->getCode()] = [
'formElement' => 'wysiwyg',
'label' => $store->getName().'_'.$store->getSortOrder(),
'wysiwyg' => true,
'wysiwygConfigData' => [
'hidden' => false,
'add_widgets' => false,
'add_variables' => false,
],
'validation' => ['required-entry' => true],
'template' => 'ui/form/field'
];
foreach ($fields as $name => $fieldConfig)
$fieldInstance = $this->fieldFactory->create();
$fieldInstance->setData(
[
'config' => $fieldConfig,
'name' => $name,
]
);
$fieldInstance->prepare();
$this->addComponent($name, $fieldInstance);
return parent::getChildComponents();
Still wonder if there is any chance to group fields like address field in order form, something like message[en]
add a comment |
I needed to add 'template' => 'ui/form/field'
in field configuration so now the code is
public function getChildComponents()
$stores = $this->storeManager->getStores();
uasort(
$stores,
function (MagentoStoreModelStore $storeA, MagentoStoreModelStore $storeB)
return $storeA->getSortOrder() <=> $storeB->getSortOrder();
);
foreach ($stores as $store)
$fields['message_'.$store->getCode()] = [
'formElement' => 'wysiwyg',
'label' => $store->getName().'_'.$store->getSortOrder(),
'wysiwyg' => true,
'wysiwygConfigData' => [
'hidden' => false,
'add_widgets' => false,
'add_variables' => false,
],
'validation' => ['required-entry' => true],
'template' => 'ui/form/field'
];
foreach ($fields as $name => $fieldConfig)
$fieldInstance = $this->fieldFactory->create();
$fieldInstance->setData(
[
'config' => $fieldConfig,
'name' => $name,
]
);
$fieldInstance->prepare();
$this->addComponent($name, $fieldInstance);
return parent::getChildComponents();
Still wonder if there is any chance to group fields like address field in order form, something like message[en]
I needed to add 'template' => 'ui/form/field'
in field configuration so now the code is
public function getChildComponents()
$stores = $this->storeManager->getStores();
uasort(
$stores,
function (MagentoStoreModelStore $storeA, MagentoStoreModelStore $storeB)
return $storeA->getSortOrder() <=> $storeB->getSortOrder();
);
foreach ($stores as $store)
$fields['message_'.$store->getCode()] = [
'formElement' => 'wysiwyg',
'label' => $store->getName().'_'.$store->getSortOrder(),
'wysiwyg' => true,
'wysiwygConfigData' => [
'hidden' => false,
'add_widgets' => false,
'add_variables' => false,
],
'validation' => ['required-entry' => true],
'template' => 'ui/form/field'
];
foreach ($fields as $name => $fieldConfig)
$fieldInstance = $this->fieldFactory->create();
$fieldInstance->setData(
[
'config' => $fieldConfig,
'name' => $name,
]
);
$fieldInstance->prepare();
$this->addComponent($name, $fieldInstance);
return parent::getChildComponents();
Still wonder if there is any chance to group fields like address field in order form, something like message[en]
edited Jul 5 at 18:42
answered Jul 5 at 18:36
krybbiokrybbio
6897 silver badges22 bronze badges
6897 silver badges22 bronze badges
add a comment |
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%2f281000%2fmagento-2-wysiwyg-field-in-custom-admin-form%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