Skip to content

Instantly share code, notes, and snippets.

@twaurisch
Created May 20, 2015 17:17
Show Gist options
  • Select an option

  • Save twaurisch/a55a3c836c0600e683e0 to your computer and use it in GitHub Desktop.

Select an option

Save twaurisch/a55a3c836c0600e683e0 to your computer and use it in GitHub Desktop.

Revisions

  1. twaurisch created this gist May 20, 2015.
    41 changes: 41 additions & 0 deletions FormEngine.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,41 @@
    <?php
    namespace BTU\BtuDevlib\Xclass\Backend\Form;

    use TYPO3\CMS\Core\Utility\GeneralUtility;

    class FormEngine extends \TYPO3\CMS\Backend\Form\FormEngine {

    /**
    * Backport from TYPO3 7.x
    * Changeset: 9a6a133c9aa3db73ba9983a9cdd1cd28467de03c
    * Ticket: #24906
    *
    * @param string $table The table name of the record
    * @param string $field The field name which this element is supposed to edit
    * @param array $row The record data array where the value(s) for the field can be found
    * @param array $PA An array with additional configuration options.
    * @return string The HTML code for the TCEform field
    * @deprecated since 6.2, will be removed two versions later
    */
    public function getSingleField_typeText($table, $field, $row, &$PA) {
    $item = parent::getSingleField_typeText($table, $field, $row, $PA);

    $delim = '>';
    $config = $PA['fieldConf']['config'];

    $maxlengthAttribute = '';
    if (isset($config['max']) && (int)$config['max'] > 0) {
    $maxlengthAttribute = ' maxlength="' . (int)$config['max'] . '"';

    $splitTag = GeneralUtility::trimExplode($delim, $item, FALSE, 2);
    if (stripos($splitTag[0], 'maxlength') === FALSE) {
    $splitTag[0] = $splitTag[0] . $maxlengthAttribute;
    $item = implode($delim, $splitTag);
    }
    }

    // Return field HTML:
    return $item;
    }

    }
    20 changes: 20 additions & 0 deletions ext_localconf.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    <?php
    if (!defined ('TYPO3_MODE')) {
    die ('Access denied.');
    }

    $boot = function($packageKey) {

    // ...

    if (version_compare(TYPO3_branch, '7.0', '<') === TRUE) {
    $GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects']['TYPO3\CMS\Backend\Form\FormEngine'] = array(
    'className' => 'BTU\BtuDevlib\Xclass\Backend\Form\FormEngine'
    );
    }

    // ...
    };

    $boot($_EXTKEY);
    unset($boot);