Task #30851
closed
Add CSS Class to special input types in FORM
Added by Ingo Pfennigstorf almost 13 years ago.
Updated almost 7 years ago.
Description
With the new FORM Object all elements are nested in an ordered list.
In my case I added a hidden field. The structure is
ol
- li
- - input
(screenshot)
All li elements have a class like csc-form-2, csc-form-2
It may be not optimal to format the output properly in the frontend with li>input[:hidden] (or similar), so my suggestion is to add a class like "csc-form-2 input-hidden" to the li-element or "csc-form-2 input-textarea" depending on the following input fieldtype.
Files
Actually I wanted to put it into gerrit - but it failed updating some refs. In the mean time here is my solution for sysext/form/Classes/View/Form/Element/Abstract.php - starting line 368
/**
* Return the id for the element wraps,
* like <li class="csc-form-2 tx_form-hidden"> ... </li>
*
* @return string
*/
public function getElementWrapId() {
$elementId = (integer) $this->model->getElementId();
$fieldType = $this->model->getAttributes();
$wrapId = 'csc-form-' . $elementId;
if (gettype($fieldType['type']) === 'object') {
$wrapId .= ' tx_form-' . $fieldType['type']->getValue();
}
return $wrapId;
}
Patch set 1 of change Ia14641d488f10e2a60f9ba0fafdc10f31d0eeb1d has been pushed to the review server.
It is available at http://review.typo3.org/5745
- Status changed from New to Under Review
Patch set 2 of change Ia14641d488f10e2a60f9ba0fafdc10f31d0eeb1d has been pushed to the review server.
It is available at http://review.typo3.org/5745
Patch set 3 of change Ia14641d488f10e2a60f9ba0fafdc10f31d0eeb1d has been pushed to the review server.
It is available at http://review.typo3.org/5745
- Target version set to 4.7.0-alpha1
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Reverted in favour of issue #31561
- TYPO3 Version changed from 4.6 to 4.7
- Status changed from Resolved to Closed
Also available in: Atom
PDF