Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Templated form elements #1584

Open
wants to merge 8 commits into
base: 2.0.x
Choose a base branch
from

Conversation

fiammybe
Copy link
Member

@fiammybe fiammybe commented Oct 22, 2024

CSS frameworks (Bulma, Bootstrap, Tailwind, ...) and almost every theme out there need specific HTML markup for their form solution to work well. The HTML implementation in the core was not flexible enough to allow that. I started with a button, and will gradually transform all hardcoded HTML in the core to using templates.

I've started with these 4:

  • Text Area
  • Password
  • Button
  • Checkbox

Other parts will come in other PRs

Smarty is included in the core specifically for this kind of functionality, so let's not re-invent the wheel.

Added benefit : by using Smarty we should also have template caching, for that extra micro-second of speed :-)

@fiammybe fiammybe requested a review from skenow October 22, 2024 12:49
@skenow skenow modified the milestone: 2.0.0 (new) Oct 24, 2024
@fiammybe fiammybe added this to the 2.0.1 milestone Dec 27, 2024
@fiammybe fiammybe modified the milestones: 2.0.1, 2.0.2 Jan 8, 2025
@fiammybe fiammybe marked this pull request as ready for review January 14, 2025 08:35
@fiammybe fiammybe self-assigned this Feb 2, 2025
@fiammybe fiammybe requested a review from MekDrop February 3, 2025 20:46
/**
* template for this field
*/
protected icms_view_Tpl $_tpl;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we for new vars not use _ prefix? it's doesn't make sense

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it was in the early PHP4 days a convention to show that it was a protected variable. You are right, it doesn't make any sense anymore and I'll change it.

Comment on lines +119 to +124
$this->_tpl = new icms_view_Tpl();
$this->_tpl->assign('type', $this->getType());
$this->_tpl->assign('name', $this->getName());
$this->_tpl->assign('id', $this->getName());
$this->_tpl->assign('value', $this->getValue());
$this->_tpl->assign('extra', $this->getExtra());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some formatting issue I think is here? somehow it's looks without indent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

3 participants