How to configure and Customized Typo3 Form.

Often we are using powermail extension to make our contact or newsletter form, the reason behind using the powermail is to his frontend UI and responsive support which works for all kind of media.

But since Typo3 provides it’s built in Form extension it is now as easy to configure that were never before. Generally form is configured through .yaml file, it will be by default creates in fileadmin directory.

TRITUM, TYPO3 agency that performs significant roles on the “Form Framework Initiative”  is a winner of the Thuringian Open Source Prize 2019, firstly awarded by ITnet Thüringen in the scope of IT-Exhibition in Erfurt, Read the article.

Why should every Typo3 developer use Form

TYPO3 – Allow translated News or custom extension records appear without a Transl.Orig?

If someone wants to display records languagewise but without translation from default language. for eg. my client wants to display different blogs with DE and EN but without l10n_parent.

Those translated (where translation parent is set) display fine, but we cannot get those without translation to display no matter the settings.

I see one of the extension for doing such things:
https://github.com/georgringer/extbase_records_with_no_l10n_parent

This extension changes the behaviour of Extbase to show also records without a language parent.

Disable 307 redirect while editing page slug from backend.

When i change a url segment (slug) then TYPO3 always creates a 307 redirect.
Auto redirect behaviour can be changed in your config.yaml

settings:
  redirects:
    # Automatically update slugs of all sub pages
    # (default: true)
    autoUpdateSlugs: true

    # create redirects for pages with a new slug
    # (default: true)
    autoCreateRedirects: false

    # HTTP status code for the redirect,
    # (default: 307)
    httpStatusCode: 307

Just make “autoCreateRedirects” false to make automatic redirect.

Language condition for TYPO3.

Just as we used in TYPO3 provides different Condition for simple control structures. In Typo3 9 version we have some difference in typoscript language condition.

upto TYPO3 8 version we used language condition like this:

[globalVar = GP:L = 1]
config {
sys_language_uid = 1
language = de
locale_all = de_DE.UTF-8
htmlTag_langKey = de
htmlTag_setParams = lang="de"
}
[global]

Now in TYPO3 9 we used like this:

[siteLanguage = locale = de_DE.UTF-8]
[global]

TYPO3 10 we can use something like this:

[siteLanguage("locale") == "en_US.UTF-8"]
  lib.logout = TEXT
  lib.logout {
    value = Logout
    typolink.parameter = &logintype=logout
    wrap =  | 
  }
[global]

TYPO3 Remove “copy 1” and “Translate to English”

I use TYPO3 version 10.4.4. When i translate en element or a page in the backend, then for the new one there is the title always “[TRANSLATED TO …. ]” or for copying elements it says then “(copy 1)”

Add Typoscript inside PageTSConfig of Root page so, it will apply to all subpages.

TCEMAIN.table.pages {
  disablePrependAtCopy = 1
  disableHideAtCopy = 1
}
TCEMAIN.table.tt_content {
  disablePrependAtCopy = 1
  disableHideAtCopy = 1
}
TCEMAIN.clearCacheCmd = 1

Debug/Parse Typo3 Extbase Fluid query

$queryParser = $this->objectManager->get(    \TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser::class
);
\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump(
$queryParser->convertQueryToDoctrineQueryBuilder($query)->getSQL()
);
\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump(
$queryParser->convertQueryToDoctrineQueryBuilder($query)->getParameters()
);

use TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser;
$queryParser = $this->objectManager->get(Typo3DbQueryParser::class);
\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump(
  $queryParser->convertQueryToDoctrineQueryBuilder($query)->getSQL()
);
//to find parameters
\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump(
   $queryParser->convertQueryToDoctrineQueryBuilder($query)
->getParameters()
);

TYPO3 Website Optimize Speed and Performance

1) Use Optimized Images using parameters like image quality and crop/resize.
2) Make Version upto date.
3) Compress JS and CSS.
Using config.compressCss = 1, config.compressJs = 1
4) Concatenate Js and Css.
Using config.concatenateCss = 1, config.concatenateJs = 1
5) Use W3c Standard for Js and css to include css in header and js in footer.
6) Disabel TYPO3 Logs.

# Inside LocalConfiguration.php;
$TYPO3_CONF_VARS['SYS']['belogErrorReporting'] = '0';
$TYPO3_CONF_VARS['BE']['versionNumberInFilename'] = '1';
$TYPO3_CONF_VARS['SYS']['enableDeprecationLog'] = '0';
$TYPO3_CONF_VARS['SYS']['syslogErrorReporting'] = '0';
$TYPO3_CONF_VARS['SYS']['systemLogLevel'] = '4';
$TYPO3_CONF_VARS['SYS']['sqlDebug'] = false;

7) Optimizing Typoscript conditions and code.
– Remove unnecessary Typoscript code.
– Adding only required template extensions.
– Include TSConfig & TypoScript via INCLUDE_TYPOSCRIPT
– Avoid TYPO3 backend template for TypoScript & Setup file based TypoScript
8) Use CDN if possible.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js.js"><script>

9) Enable Gzip compression and leverage browser caching in .htaccess

AddType "text/javascript" .gzip
AddType "text/css" .gzip
AddEncoding gzip .gzip

10) Proper handling of 404 page.
11) Use of sprite images so, that only one image loaded, so, other images can be use by css using position.

Typoscript to Get Loggedin user information

I am having one powermail extension form in my logged access page, this form only shows when frontend user loggedin. But in those form fields i wanted to prefill Loggedin user info. like name, email, usergroup and other details.

Add Current Date In Date Field:

plugin.tx_powermail.settings.setup.prefill.datum = TEXT
plugin.tx_powermail.settings.setup.prefill.datum {
    data = date:U
    strftime = %d.%m.%Y
}

Prefill Current Usergroup In group Field:

plugin.tx_powermail.settings.setup.prefill {
   kundennummer= TEXT
   kundennummer.data = TSFE:fe_user|user|usergroup
   kundennummer.split {
    token = ,
    cObjNum = 1 || 2
    1 {
      10 = CONTENT
      10.table = fe_groups
      10.select.pidInList = 22
      10.select.where.current = 1
      10.select.where.wrap = uid= |
      10.renderObj = TEXT
      10.renderObj.field = title
      10.renderObj.wrap = |
    }
    2 < .1
    2.10.renderObj.noTrimWrap = |, ||
   }
  }
}

Note: In above typoscript datum,kundennummer are the fields of powermail form field., it should same as TS Object.
You can fetch details same for other fields. like this way we can fetch any other extension information as well in powermail fields.

How to disable cHash for custom extension

I got 404 error while making ajax request using switchablecontroller action, but i did not passed chash in request url because i am using ajax so, i have no chash.

url: url ? '' : url,
type: 'POST',
cache: true,
data: {
  'type' :'5000',
  'ajax': 1,
  'tx_recipe_pi1[preparation]': categoryPreparationUid,
  'tx_recipe_pi1[ingredient]': categoryIngredientsUid,
  'tx_recipe_pi1[order]': sorting,
  'tx_recipe_pi1[@widget_0][currentPage]': page ? page : 0
}

I fixed this error by disable chash from argument in typoscript. so, it will not add chash argument in your extension link.

plugin.tx_recipe.features.requireCHashArgumentForActionArguments = 0