-
Notifications
You must be signed in to change notification settings - Fork 35
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
base: 2.0.x
Are you sure you want to change the base?
Templated form elements #1584
Conversation
…function name should be a string.
…ic markup for forms.
/** | ||
* template for this field | ||
*/ | ||
protected icms_view_Tpl $_tpl; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
$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()); |
There was a problem hiding this comment.
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
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:
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 :-)