Jump to content

Override Form in modern Module


Recommended Posts

Hi everyone,

In the Symfony format of "modern" modules, it is not possible to override the content of the code located in the "src" folder of said module with the classic folder replacement method.

For example, if I want to modify the behavior of the module "Link Widget" (ps_linklist), I replace the line of the file /modules/ps_linklist/src/Form/Type/CustomUrlType.php :

'constraints' => [new Assert\Url()],

with :

'constraints' => [new Assert\NotBlank()],

this allows me to use relative urls (and it works fine when making changes in the module). My question is how about overriding the class presents in "src" with "modern" modules? Because this risks becoming the norm, and being able to make some modifications on modules is still practical or even necessary in certain cases, and I refuse to modify directly the files of the modules, because the modifications have to be redone at each update ...

I looked but I did not find, if ever someone has a solution, or even avenues to explore, I am interested! 😉

Thank you in advance. 😊

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...