- Posts: 63
- Thank you received: 1
mod_eb_search customization
- Russell Leigh
- Topic Author
- Offline
- Senior Member
-
Please Log in or Create an account to join the conversation.
- Tuan Pham Ngoc
- Offline
- Administrator
-
![:) :)](/media/kunena/emoticons/8.png)
Please Log in or Create an account to join the conversation.
- Russell Leigh
- Topic Author
- Offline
- Senior Member
-
- Posts: 63
- Thank you received: 1
It makes it very difficult as a developer to override and style these modules and components without writing lines and lines of css or having to open support tickets and spend days trying just to add some bootstrap classes.
I understand about doing things OOP with reusable code but it is possible to still use classes and output html. That is literally the whole concept of Joomla. Layout overrides.
Why have you made it so difficult, even impossible in some cases, to override this component/module?
Please Log in or Create an account to join the conversation.
- Tuan Pham Ngoc
- Offline
- Administrator
-
- You can even overridable controller, model, view and helper classes (basically, not just layout but also core code is also overridable), see eventbookingdoc.joomservices.com/develop...stomization-override . Even Joomla core does not support the option.
- The extension is one (in not many, I believe) works pretty well with Bootstrap 3, Bootstrap 4, UIKIT3
- Each field type (textbox, area....), if it's needed, can be overridable (look at the layout for these inputs in components/com_eventbooking/themes/default/fieldlayout
Of course, not everything is inside the layouts as you said. However, with a clever code, you can copy the code form the module file (which generate the dropdowns in the module) to the layout file and override it if needed
Imagine that you need to change the dropdown which generate categories on create article form in Joomla core, exactly how you would override it? I think it's not easy, too
I am trying my best to make the extension easier to extensible and open for suggestions (that's the reason I implemented the changes you mentioned into core code). So if you have any suggestions to make it better, feel free to suggest and I will try to support it
Tuan
Please Log in or Create an account to join the conversation.
- Russell Leigh
- Topic Author
- Offline
- Senior Member
-
- Posts: 63
- Thank you received: 1
I've just spent days on this forum trying to simply add the standard bootstrap classes to inputs....
"You can even overridable controller, model, view and helper classes"
This is very cool functionality and I wish it was in joomla core, but where in that list of static methods that can be overridden is the output of the selects for the module?
It is kind of bad practice to put html inside of php. You should output the variables to the template file and then use proper html rather than building the html inside the class and then just rendering the whole thing as a single variable.
In this way it would make the templates very easy to override and add classes or custom column layouts
"Of course, not everything is inside the layouts as you said. However, with a clever code, you can copy the code form the module file (which generate the dropdowns in the module) to the layout file and override it if needed"
Not best practice to override those methods in the template file.
There is no reason for this to be in the module file and not in the template file
```
$lists = JHtml::_('select.genericlist', $options, 'category_id', [
'option.text.toHtml' => false,
'list.attr' => 'class="inputbox category_box' . $bootstrapHelper->getFrameworkClass('form-control', 1) . '"',
'option.text' => 'text',
'option.key' => 'value',
'list.select' => $categoryId,
]);
```
"Imagine that you need to change the dropdown which generate categories on create article form in Joomla core, exactly how you would override it? I think it's not easy, too"
Why would you ever need to do this? I don't want to override things in the backend. Only the front end to integrate with the template.
If you mean the edit screen on the front end you can easily edit form fields by doing something like the following in the override, then you can add the css classes to the field
```
$this->form->reset(true);
$this->form->loadFile(__DIR__ . DIRECTORY_SEPARATOR. "forms" . DIRECTORY_SEPARATOR . "registration.xml");
```
You can then implement your own form xml
Please Log in or Create an account to join the conversation.
- Tuan Pham Ngoc
- Offline
- Administrator
-
I've just spent days on this forum trying to simply add the standard bootstrap classes to inputs....
=> Sorry but you don't have to do that. The css class is configurable per fields as you figured out
It is kind of bad practice to put html inside of php. You should output the variables to the template file and then use proper html rather than building the html inside the class and then just rendering the whole thing as a single variable.
=> I'm not sure about this case. The different thing in my extension compare to Joomla core is that we use don't use XML Form for form definition in Joomla core. The code for generating the dropdown contains query data from database, so I'm unsure it's a right idea to query the data from database, store it in variable and then calls JHtml method layout file to generate the dropdown. In many years of Events Booking life, honestly, I haven't heard anyone complains about it. The idea is that it should work out of the box with the supported frontend frameworks, if not, then it's a bugs and I am willing to fix it (as in some cases you reported and it got fixed). The single dropdown has it own css class, so if it's needed, you can add css code to style it if needed. I think that's stable enough for most of the cases
Why it's not perfect, it's acceptable, I think.
I won't spend time to discuss more about this case. However, if you have any difficulty with making the extension compatible with twitter bootstrap 4, please let me know and I'm open to work to improve it
Regards,
Tuan
Please Log in or Create an account to join the conversation.
- Russell Leigh
- Topic Author
- Offline
- Senior Member
-
- Posts: 63
- Thank you received: 1
where in that list of static methods that can be overridden is the output of the selects for the module?
JHtml should be called from within a template file. This is the proper joomla way. It doesn't need xml forms to call it in the template file and therefore make the classes editable
"you can add css code to style it if needed" This is not right. You shouldn't have to write loads of css just to match a field. You should just be able to add whatever class you want
You say you are open to work to improve it but you wont make those classes editable on the dropdowns and do it in the proper joomla way so things can be overridden, so...???
Please Log in or Create an account to join the conversation.
- Tuan Pham Ngoc
- Offline
- Administrator
-
And back to this issue, I have now support form-control in the select, so exactly what you want to change now?
Please Log in or Create an account to join the conversation.
- Russell Leigh
- Topic Author
- Offline
- Senior Member
-
- Posts: 63
- Thank you received: 1
Please Log in or Create an account to join the conversation.
- Tuan Pham Ngoc
- Offline
- Administrator
-
Otherwise, please use it as how it's
Tuan
Please Log in or Create an account to join the conversation.
Support
Documentation
Information
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.