mod_eb_search customization

  • Russell Leigh
  • Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
More
7 months 2 days ago #133873 by Russell Leigh
Replied by Russell Leigh on topic mod_eb_search customization
I give up man. Don't worry about it. Have a great day.

Please Log in or Create an account to join the conversation.

More
7 months 2 days ago #133874 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic mod_eb_search customization
Don't give up. I will make the change then although my idea is that it should work out of the box without necessary for modification (that's why I added form-control to it as discussed)

Please Log in or Create an account to join the conversation.

More
7 months 2 days ago #133876 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic mod_eb_search customization
OK. Here is the updated module (it's updated in download package on server as well).

Have a nice day.

Tuan
Attachments:

Please Log in or Create an account to join the conversation.

  • Russell Leigh
  • Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
More
7 months 2 days ago #133877 by Russell Leigh
Replied by Russell Leigh on topic mod_eb_search customization
It should still work exactly the same out of the box.

Don't worry tho, it has the classes I need now and this is the last joomla site I will ever build and last plugin I will ever buy.

In proper frameworks (or I do it in plain php too) you output just the variables needed, like the array of countries to loop through that array to create the options for a select. Therefore all the logic is completely separate from the view. This is best practice.

I'm used to building on Symphony or Laravel or sometimes Phalcon with proper decoupled front ends, so this Joomla thing is a real drag. It's all very messy.

Please Log in or Create an account to join the conversation.

More
7 months 2 days ago #133879 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic mod_eb_search customization
Ah, I see. If you compare the quality of code from Joomla with Symfony or Laravel , then Yes, I can see that Joomla cannot be compared in many areas.

Anyway, I made the change as requested. While it give a bit more flexible, it also comes with some cost (like the code have to be repeated in every layouts which the module support), so it looks a bit mess, too.

Please continue using the extension. If you have any issues or suggestions, please don't hesitate to ask/suggest

Regards,

Tuan

Please Log in or Create an account to join the conversation.

  • Russell Leigh
  • Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
More
7 months 2 days ago - 7 months 2 days ago #133882 by Russell Leigh
Replied by Russell Leigh on topic mod_eb_search customization
You have to output code in every layout where it appears anyway. Better that the code is editable than just "echo $var" and not being able to override any of it or even know what the variable is or where it comes from. I understand about writing "reusable" code but it should also actually be useable and readable and easily edited.

What if you wanted different css classes on different pages/layouts? What if you wanted to set other parameters or attributes like the dataset or autofocus or required? Or add a static option to a select?

Best practices of any language the logic and view is separated. Doesn't matter if it's Python or C or Java or GO or Swift or whatever you are running server side, the logic should be separate from the view as much as possible. That is just simple programming best practices

In joomla core most of the logic and view is separated and JHtml is used to render certain elements and the rest are just html. You can see this in almost any of the core joomla components along with the xml forms. Even J4 uses xml forms and you can override the xml to add css classes or whatever you want.

The form fields are rendered with renderField() method of the JForm class but you use getControlGroup() which is deprecated but maybe overridden in your proprietary class. There is no need for a proprietary form class as joomla has all the functionality in the API. So your forms should be using XML and renderField to be properly integrated with joomla.

Check out com_content to start. Nearly all the layout files have JHtml in them, look at the front end edit form "components/com_content/views/form/tmpl/edit.php", on line 56 JHtml is used to render tabs, you can edit this call to add params/attributes etc. In the model folder is the forms "components/com_content/models/forms/article.xml" and you can override these xml files to add attributes to the fields.

When I build systems (I specialise in PWAs) I decouple the front end completely and run the back end as an api. Therefore everything is loaded asynchronously and ALL the logic is done server side. Endpoints just return JSON data and the JS (vue/react/svelte) deals purely with DOM manipulation. I understamd this isn't completely possible with Joomla but we can at least follow best practices in general
Last edit: 7 months 2 days ago by Russell Leigh.

Please Log in or Create an account to join the conversation.