mod_eb_search customization

  • Russell Leigh
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
4 years 2 hours ago #133861 by Russell Leigh
Replied by Russell Leigh on topic mod_eb_search customization
OK sorry I see it is an attachment now. That's sorted it thanks!

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

  • Tuan Pham Ngoc
  • Away
  • Administrator
  • Administrator
More
4 years 2 hours ago #133862 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic mod_eb_search customization
Great :)

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

  • Russell Leigh
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
4 years 2 hours ago #133863 by Russell Leigh
Replied by Russell Leigh on topic mod_eb_search customization
Why though, is everything embedded in your proprietary form and input classes?

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
  • Away
  • Administrator
  • Administrator
More
4 years 24 minutes ago #133866 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic mod_eb_search customization
Honestly, I don't know why it's so difficult as you said. Everything is configurable and if it's needed, could be overidable:

- 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
  • Senior Member
More
3 years 11 months ago #133867 by Russell Leigh
Replied by Russell Leigh on topic mod_eb_search customization
"Honestly, I don't know why it's so difficult as you said. Everything is configurable and if it's needed, could be overidable:"

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
  • Away
  • Administrator
  • Administrator
More
3 years 11 months ago #133868 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic mod_eb_search customization

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
  • Senior Member
More
3 years 11 months ago #133869 by Russell Leigh
Replied by Russell Leigh on topic mod_eb_search customization
But it wasn't configurable. It had to be edited in a class that cannot be overridden. Otherwise we wouldn't be having this conversation

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
  • Away
  • Administrator
  • Administrator
More
3 years 11 months ago #133870 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic mod_eb_search customization
Joomla does not use none XML form now, so I'm unsure what's proper Joomla way. Could you show me where in Joomla core use JHtml in the layout?

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
  • Senior Member
More
3 years 11 months ago #133871 by Russell Leigh
Replied by Russell Leigh on topic mod_eb_search customization
Haha wtf!? Facepalm.

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

  • Tuan Pham Ngoc
  • Away
  • Administrator
  • Administrator
More
3 years 11 months ago #133872 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic mod_eb_search customization
So I want to ask it again: Do you still need to make override to the layout now? If Yes, I will move it to the layout file

Otherwise, please use it as how it's

Tuan

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