View Single Post
  #11  
Old 06-26-2018, 03:20 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default Re: Decorate XC module

Quote:
Originally Posted by amarquis
For example: admin.php?target=global_tabs -> Then click on "New tab".

Here there are 2 fields with the WYSIWYG editor: "Content" and "Brief info"
"Content" field works with my changes (removed some buttons)
"Brief info" doesn't

- The "Add product" form, it doesn't work
- The "Edit category" form, it works
- For Vendors, My Account -> Company details -> Description, it works but I am quite surprised as I am pretty sure it did not work a few days/weeks ago.

Thx

Thanks for the additional details.

"Brief info" on Product tabs > New tab does not work, because it is defined by other form field class:
Code:
\XLite\Module\XC\CustomProductTabs\View\FormField\Textarea\FroalaBriefInfo

So, you want to change it as well.

As for "Add product", it does not work because its textarea is defined by the
Code:
\XLite\View\FormModel\Type\TextareaAdvancedType
class, which essentially inherits
Code:
\Symfony\Component\Form\Extension\Core\Type\TextareaType
one.

FroalaEditor module uses
Code:
\XLite\Module\XC\FroalaEditor\View\FormModel\Type\TextareaAdvancedType
class to define Froala as editor widget for this class and it sets up Froala settings via this method:

Code:
public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults( [ 'oldType' => 'XLite\Module\XC\FroalaEditor\View\FormField\Textarea\Advanced', ] ); }

So, you should decorate
Code:
\XLite\View\FormModel\Type\TextareaAdvancedType
class and define configureOptions() method to use your class
Code:
XLite\Module\Udg\Tweaks\View\FormField\Textarea\Advanced
instead of
Code:
XLite\Module\XC\FroalaEditor\View\FormField\Textarea\Advanced

Let me know if it makes sense to you.

Tony
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote