Skip to main content
2 of 2
deleted 16 characters in body

If anyone else needs a more complete answer based on '@gajjala sandeep' response:

<?php
namespace XXX\XXX\Plugin\Amasty\Label\Block\Adminhtml\Labels\Edit\Tab;

class Conditions
{
    /**
     * @var \Magento\Framework\Registry
     */
    private $registry;

    /**
     * @param \Magento\Framework\Registry $registry
     */
    public function __construct(
        \Magento\Framework\Registry $registry
    ) {
        $this->registry = $registry;
    }

    /**
     * @param \Amasty\Label\Block\Adminhtml\Labels\Edit\Tab\Conditions $subject
     * @param \Closure $proceed
     * @return string
     */
    public function aroundGetFormHtml( 
        \Amasty\Label\Block\Adminhtml\Labels\Edit\Tab\Conditions $subject,
        \Closure $proceed
    ) { 
        $form = $subject->getForm();
        if (is_object($form)) { 
            /* Get the fieldset by the parent form's fieldset name */
            $fieldset = $form->getElement('conditions_fieldset');
            $fieldset->addField( 
                'fieldname', 'textarea', 
                ['name' => 'fieldname', 'label' => __('Story B'), 'title' => __('Story B') ]
            ); 

            $model = $this->registry->registry('current_amasty_label');
            $form->addValues($model->getData()); // Using addData() to keep previous data but you can add only your data like: addData(['fieldname' => 'value'])
            $subject->setForm($form); 
        } 
        
        return $proceed(); 
    }
}

Declare the plugin on XXX/XXX/etc/adminhtml/di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Amasty\Label\Block\Adminhtml\Labels\Edit\Tab\Conditions">
        <plugin name="xxx_xxx_edit_tab_conditions" type="XXX\XXX\Plugin\Amasty\Label\Block\Adminhtml\Labels\Edit\Tab\Conditions" />
    </type>
</config>

I hope that helps who come here in the future :)