Task #30851

Add CSS Class to special input types in FORM

Added by Ingo Pfennigstorf almost 11 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Should have
Category:
Frontend
Target version:
Start date:
2011-10-12
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
4.7
PHP Version:
5.3
Tags:
Complexity:
Sprint Focus:

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

Auswahl_003.jpeg (12.9 KB) Auswahl_003.jpeg Ingo Pfennigstorf, 2011-10-12 16:25
#1

Updated by Ingo Pfennigstorf almost 11 years ago

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;
    }
#2

Updated by Mr. Hudson almost 11 years ago

Patch set 1 of change Ia14641d488f10e2a60f9ba0fafdc10f31d0eeb1d has been pushed to the review server.
It is available at http://review.typo3.org/5745

#3

Updated by Mr. Hudson almost 11 years ago

  • 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

#4

Updated by Mr. Hudson almost 11 years ago

Patch set 3 of change Ia14641d488f10e2a60f9ba0fafdc10f31d0eeb1d has been pushed to the review server.
It is available at http://review.typo3.org/5745

#5

Updated by Steffen Ritter over 10 years ago

  • Target version set to 4.7.0-alpha1
#6

Updated by Ingo Pfennigstorf over 10 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
#7

Updated by Oliver Hader over 10 years ago

Reverted in favour of issue #31561

#8

Updated by Oliver Hader over 10 years ago

  • TYPO3 Version changed from 4.6 to 4.7
#9

Updated by Riccardo De Contardi almost 5 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF