TYPO3 LTS 9

Aus Vosp.info
Wechseln zu:Navigation, Suche

TYPO3 LTS 9 | TYPO3 LTS 8 | TYPO3.CMS 7.6 Schnipsel | Typo3 | Typo3 Entwicklereinstellungen | Typo3 Endbenutzer Hilfe

Inhaltsverzeichnis

Benötigte Software & Konfiguration

apt-get install imagemagick  wget bash-completion zip unzip  apache2 libapache2-mod-php7.2 php7.2-cli  php7.2 php7.2-common  php7.2-imap php7.2-intl php7.2-mysql php7.2-readline  php7.2-soap php7.2-zip php7.2-zip php7.2-gd php7.2-xml php7.2-gd php7.2-json php7.2-opcache php-imagick  php7.2-curl php7.2-mbstring php7.2-bcmath php7.2-gmp php7.2-zip mysql-server composer

a2enmod deflate rewrite headers mime expires ssl

mysql_secure_installation

USE mysql;
UPDATE user SET plugin='mysql_native_password' WHERE User='root';
FLUSH PRIVILEGES;
exit;

#Falls Die Sicherheit für Passwörte nachträglich geändert werden muss.
mysql$ SHOW VARIABLES LIKE 'validate_password%';

mysql$ SET GLOBAL validate_password_policy=LOW;

vim /etc/mysql/mysql.conf.d/mysqld.cnf
#add 
[mysqld]
validate_password_policy=LOW





Typo3 Grundinstallation

t3 Installation mit git

cd in /var/www/domain
git clone https://github.com/TYPO3/TYPO3.CMS.git
cd TYPO3.CMS/
git fetch --tags
git tag --list
git checkout tags/v.9.5.1
#Externe Bibliotheken installieren
composer install

cd ..
ln -s TYPO3.CMS typo3_src
ln -s typo3_src/typo3 typo3
ln -s typo3_src/index.php .
touch FIRST_INSTALL



# /etc/php/7.2/apache2/php.ini
max_execution_time = 240
max_input_vars = 1500

t3 Installation mit composer

composer create-project "typo3/cms-base-distribution:^9.5" blanco9.netz.coop
cd blanco9.netz.coop
php vendor/bin/typo3cms install:setup



Konfiguration

Debug

.htaccess

SetEnv TYPO3_CONTEXT Development


LocalConfiguration.php

Mail

Achtung "Configuration Presets (Global Configuration)" unter Einstellungen, sugeriert nicht das auch defaultMailFromAddress angegeben werden muss :(

<?php
return [
    'MAIL' => [
        'defaultMailFromAddress' => 'xxxx@domain.tld',
        'defaultMailFromName' => 'xxxx domain.tld',
        'transport' => 'smtp',
        'transport_sendmail_command' => '/usr/sbin/sendmail -t -i ',
        'transport_smtp_encrypt' => 'tls',
        'transport_smtp_password' => 'password',
        'transport_smtp_server' => 'mx.domain.tld:25',
        'transport_smtp_username' => 'xxxx@domain.tld',
    ],
];

Module

Sites

Sprachen lanugages

Achtung, derzeit existiert ein language fallback BUG :( 
https://forge.typo3.org/issues/86762
Seiten welche noch nicht übersetzt sind, kommen auf ne 404 Seite 
  1. erstmal müssen Sprachen angelegt werden auf der Seite 0 (ganz ganz oben in der Seiten Hierrachie) ... dann kann angefangen werden Sprachen über Sites zu konfigurieren
  2. die Startseite (auch wenn nur Verweis) muss übersetzt werden mit dem Seiten oder Listen Modul
page = PAGE
page {
	10 = FLUIDTEMPLATE
	10 {
		dataProcessing {

			120 = TYPO3\CMS\Frontend\DataProcessing\LanguageMenuProcessor
			120 {
			  languages = auto
			  as = ncMenuLanguage
			}

		}
	} 
}

Entwicklung

extbase

link erstellen

	$objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class);
	$uriBuilder = $objectManager->get(\TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder::class);
	$uri = $uriBuilder
	  ->reset()
	  ->setTargetPageUid($confArray['ncChPwPluginPageId'])
//	  ->setArguments($getArgs) 
	  ->uriFor(	
			'ncchpwnoticeandmail', 
			['cruser' => \Netzcoop\Anclib\Services\NcCrypt::encrypt($feUserId, 'passwort'], 
			'Ncchpw',
			'ancregister',
			'ncchpwplugin'
		);
	}
	\TYPO3\CMS\Core\Utility\HttpUtility::redirect($uri);

fluid

TYPO3.CMS_7.6_Schnipsel#fluid

flashMessages

mit umlauten, sonderzeichen und html tags

$this->addFlashMessage('äüz<a href="link">link</a>', '', \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR);
		<f:flashMessages as="flashMessages">
		   <dl class="messages">
			  <f:for each="{flashMessages}" as="flashMessage">
				 <dt><f:format.raw>{flashMessage.code}</f:format.raw></dt>
				 <dd><f:format.raw>{flashMessage.message}</f:format.raw></dd>
			  </f:for>
		   </dl>
		</f:flashMessages>

Fehlermeldungen (unvollstängig)

class CaptchaValidator extends AbstractValidator
	// .........
	public function isValid($word)
	{
		// .........
		if (!$isValid) {
			// Please enter the word or number as it appears in the image. The entered value was incorrect.
			$this->addError(
				$this->translateErrorMessage(
					'9221561048',
					'sr_freecap'
				),
				9221561048
			);
		}
		return $isValid;
	}
}
alle Fehler anzeigen die so existieren
<f:render partial="FormErrors"  arguments="{for: 'user'}" />

speziellen Fehler anzeigen
 <f:render partial="FieldError"  arguments="{for: 'user', field: 'captcha'}" />

Ableiten

Controller ableiten

TYPO3.CMS_7.6_Schnipsel#Backend_Klassen_ableiten

  • EXT/ancregister/Classes/Controller/NcFeuserEditController.php
<?php
namespace Netzcoop\Ancregister\Controller;

class NcFeuserEditController extends \Evoweb\SfRegister\Controller\FeuserEditController {
	
	public function formAction(\Evoweb\SfRegister\Domain\Model\FrontendUser $user = null)
	{
		 parent::formAction($user);
	}
}
  • ext_localconf.php
$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects']['Evoweb\SfRegister\Controller\FeuserEditController'] = array(
	'className' => 'Netzcoop\Ancregister\Controller\NcFeuserEditController'
);


Sprache

$GLOBALS['LANG']->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:flushPageCachesTitle')


translate

TYPO3.CMS_7.6_Schnipsel#translate


	{f:translate(key: 'ncchpw.passwordExpired',
		arguments: '{
			0: "eins",
			1: "zwei",
			2: "drei"
	}') -> f:format.raw()}


sprache in typoscript für plugin anpassen
plugin.tx_cookieman._LOCAL_LANG.de {
	introText = Unsere Webseite verwendet Cookies. 
}

Extension Sprache verändern

  • Configuration/TypoScript/constants.txt
nc_password_txt = Die Länge des Passwort muß zwischen 8 und 80 Zeichen liegen. Ihr Passwort muss mindestens ein Groß- und Kleinbuchstaben haben, sowie ein Sonderzeichen oder eine Zahl enthalten.
  • Configuration/TypoScript/setup.txt
plugin.tx_sfregister._LOCAL_LANG.de {
	error_required = Bitte füllen Sie dieses Feld aus.
}

plugin.tx_srfreecap._LOCAL_LANG.de {
	notice = 
	explain =
}

# Achtung: in der felogin Plugin Konfiguration hinterlegte Meldungen überschreiben sämtliche Spracheinstellungen
plugin.tx_felogin_pi1._LOCAL_LANG.de {
	username = E-Mail-Adresse
	ll_enter_your_data = E-Mail-Adresse
	ll_forgot_header = Passwort vergessen?

#	ll_forgot_reset_message = ll_forgot_reset_message
	ll_welcome_header = Benutzeranmeldung
	ll_welcome_message = Geben Sie Ihre E-Mailadresse und Ihr Passwort ein, um sich anzumelden:
#	ll_status_header = status_header
#	ll_status_message = ll_status_message
#	ll_success_message = success_message
#	ll_logout_message = logout_message
#	ll_error_message = error_message

	// siehe oben $plugin.tx_sfregister._LOCAL_LANG.de.passwordRequirements
	ll_change_password_message = {$nc_password_txt}
	ll_change_password_notvalid_message = {$nc_password_txt}
	ll_change_password_tooshort_message = {$nc_password_txt}
	ll_change_password_notequal_message = Die Passwörter stimmen nicht überein - das neue Passwort bitte zweimal eingeben. {$nc_password_txt}
}
plugin.tx_felogin_pi1 {
	changePasswordNotValidMessage_stdWrap.wrap = <span class="errorMessage">|</span>
	changePasswordNotValidMessage_stdWrap.wrap = <span class="errorMessage">|</span>
	changePasswordTooShortMessage_stdWrap.wrap = <span class="errorMessage">|</span>
	changePasswordNotEqualMessage_stdWrap.wrap = <span class="errorMessage">|</span>
}

Sprache der Backend core Labels übersetzen

zum Beispiel im Backend unter Listen Modul die Spalten

  • EXT:ancextension/ext_localconf.php
$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['EXT:core/Resources/Private/Language/locallang_core.xlf'][] = 'EXT:ancextension/Resources/Private/Language/de.locallang_ancbe.xlf';
$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['EXT:frontend/Resources/Private/Language/locallang_tca.xlf'][] = 'EXT:ancextension/Resources/Private/Language/de.locallang_ancbe.xlf';
$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['EXT:core/Resources/Private/Language/locallang_general.xlf'][] = 'EXT:ancextension/Resources/Private/Language/de.locallang_ancbe.xlf';
  • EXT:ancextension/Resources/Private/Language/de.locallang_ancbe.xlf
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<xliff version="1.0">
   <file source-language="en" datatype="plaintext" original="messages" date="2019-03-26T18:44:59Z" product-name="lang">
      <header/>
      <body>
         <trans-unit id="LGL.enabled" xml:space="preserve">
            <target>XXXXXXXXXXXXX</target>
         </trans-unit>
         <trans-unit id="fe_users.lockToDomain" xml:space="preserve">
            <target>YYYYYYYYYYYYYYYYY</target>
         </trans-unit>		 
         <trans-unit id="labels.toggleall" xml:space="preserve">
            <target>Alle auswählen</target>
         </trans-unit>	
         <trans-unit id="rm.closeDoc" xml:space="preserve">
            <target>Speichern und Schließen</target>
         </trans-unit>	 	 
      </body>
   </file>
</xliff>

sql


select

$qB = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\ConnectionPool::class)
		->getQueryBuilderForTable('fe_users');

$qB->getRestrictions()->removeAll();		
$qB->from('fe_users');
$qB->select('*');
$qB->where(
	$qB->expr()->lte('lastlogin', (int) $timestampWaitingPeriodStart)
);		
$qB->andWhere(
	$qB->expr()->neq('lastlogin', 0)
);			
$qB->andWhere(
	$qB->expr()->eq('ancfordeletefirstreminder', 0)
);			
$qB->andWhere(
	$qB->expr()->eq('ancfordeletesecondreminder', 0)
);				
$qB->andWhere(
	$qB->expr()->eq('ancfordeletelastreminder', 0)
);							
$qB->andWhere(
	$qB->expr()->eq('deleted', (int) 0)
);
$qB->andWhere(
	$qB->expr()->eq('disable', (int) 0)
);
$qB->andWhere(
	$qB->expr()->gte('endtime', (int) time())
);				
$arrayResult = $qB->execute()->fetchAll();

foreach ($arrayResult as $rowvalue) {

}

update

$qB = GeneralUtility::makeInstance(ConnectionPool::class)
	->getQueryBuilderForTable('fe_users');
$qB->update('fe_users')
	->where(
		$qB->expr()->neq('ancfordeletefirstreminder', 0)
	)
	->andWhere(
		$qB->expr()->gte('lastlogin', (int) $timestampWaitingPeriodStart)
	)
	->set('ancfordeletefirstreminder', 0)
	->set('ancfordeletesecondreminder', 0)
	->getRestrictions()->removeAll();		
$nrOfUpdates= $qB->execute();

sql queries debuggen

$objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Extbase\Object\ObjectManager');
$frontendUserRepository = $objectManager->get('TYPO3\CMS\Extbase\Domain\Repository\FrontendUserRepository');
$users = $frontendUserRepository->findAll();
$queryParser = $objectManager->get(\TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser::class);
krexx($queryParser->convertQueryToDoctrineQueryBuilder($frontendUserRepository->createQuery())->getSQL());
// ....
$rows = $qB->execute()->fetchAll();
krexx($qB->getSQL());

Einstellungen einer Extension

  • sie befindet sich nicht mehr im Module Extension Manager sondern im Module Einstellungen, desweiteren wird sie durch De- und Neuinstallation der Extension die Einstellungen gelöscht!!! was sehr nervig sein kann
  • ext_conf_template.txt
# cat=basic/enable/010;; type=int+; label=LLL:EXT:ancfeloginaddon/Resources/Private/Language/locallang_be.xml:basic.showsentmailinfoPageId
showsentmailinfoPageId =

# cat=basic/enable/016;; type=int+; label=LLL:EXT:ancfeloginaddon/Resources/Private/Language/locallang_be.xml:basic.showAfterEmailloginPageId
showAfterEmailloginPageId =

# cat=basic/enable/020;; type=int+; label=LLL:EXT:ancfeloginaddon/Resources/Private/Language/locallang_be.xml:basic.forgotTimeForDeactivateLogin
forgotTimeForDeactivateLogin =

# cat=basic/enable/030;; type=string; label=LLL:EXT:ancfeloginaddon/Resources/Private/Language/locallang_be.xml:basic.mailsubject
mailsubject =

# cat=basic/enable/040;; type=string; label=LLL:EXT:ancfeloginaddon/Resources/Private/Language/locallang_be.xml:basic.mailsender
mailsender =

# cat=basic/enable/050;; type=user[Netzcoop\Ancfeloginaddon\ViewHelpers\TextArea->render]; label=LLL:EXT:ancfeloginaddon/Resources/Private/Language/locallang_be.xml:basic.mailtext
mailtext =

# cat=basic/enable/017;; type=options[gleich=0,ungleich=1]; label=LLL:EXT:ancfeloginaddon/Resources/Private/Language/locallang_be.xml:basic.emailcondition2
emailcondition2 =
$confArray = unserialize($GLOBALS["TYPO3_CONF_VARS"]["EXT"]["extConf"][strtolower($this->extensionName)]);


Scheduler

Task

  • Classes/Task/NcIndexTtnewsPdffilesForSearchTask.php
<?php

namespace Netzcoop\Ancext\Task;

/**
 * Description of NcIndexTtnewsPdfFilesForSearch
 *
 * @author nc
 */
class NcIndexTtnewsPdffilesForSearchTask extends \TYPO3\CMS\Scheduler\Task\AbstractTask {
    /**
     * @var string
     */
    protected $commandIdentifier;

    /**
     * @var array
     */
    protected $arguments = [];
	
    /**
     * Function execute from the Scheduler
     *
     * @return bool TRUE on successful execution
     */	
	public function execute() {
		krexx($this->getArguments());
		// ...		
		return true;		
	}
	
	
    /**
     * @param array $arguments
     */
    public function setArguments($arguments)
    {
        $this->arguments = $arguments;
    }

    /**
     * @return array
     */
    public function getArguments()
    {
        return $this->arguments;
    }	
	
    /**
     * Return a text representation of the selected command and arguments
     *
     * @return string Information to display
     */
    public function getAdditionalInformation()
	{
		$label = "spezielle Parameter: \n";
		foreach($this->commandIdentifier as $key => $value ) {
			$label .= "\t".$key.': '.$value."\n";
		}

        return $label;
    }	
	
	
    /**
     * @param string $commandIdentifier
     */
    public function setCommandIdentifier($commandIdentifier)
    {
        $this->commandIdentifier = $commandIdentifier;
    }

    /**
     * @return string
     */
    public function getCommandIdentifier()
    {
        return $this->commandIdentifier;
    }
}

AdditionalFieldProvider

diese Klasse ist für das Formular innerhalb eines Task zuständig, Felder werden definiert, validiert und gespeichert!

  • Classes/Task/NcIndexTtnewsPdffilesForSearchAdditionalFieldProvider.php
<?php

namespace Netzcoop\Ancext\Task;

class NcIndexTtnewsPdffilesForSearchAdditionalFieldProvider extends \TYPO3\CMS\Scheduler\AbstractAdditionalFieldProvider {

    /**
     * @var \TYPO3\CMS\Extbase\Mvc\Cli\CommandManager
     */
    protected $commandManager;

    /**
     * @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
     */
    protected $objectManager;

    /**
     * @var \TYPO3\CMS\Extbase\Reflection\ReflectionService
     */
    protected $reflectionService;

    /**
     * @var \TYPO3\CMS\Extbase\Scheduler\Task
     */
    protected $task;

    /**
     * Default language file of the extension linkvalidator
     *
     * @var string
     */
    protected $languageFile = 'LLL:EXT:ancext/Resources/Private/Language/locallang.xlf';
	
	
	const EXT_KEY = 'ancext_task';
	
    /**
     * Constructor
     *
     * @param \TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager
     * @param \TYPO3\CMS\Extbase\Mvc\Cli\CommandManager $commandManager
     * @param \TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService
     */
    public function __construct(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager = null, \TYPO3\CMS\Extbase\Mvc\Cli\CommandManager $commandManager = null, \TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService = null)
    {
        $this->objectManager = $objectManager ?? \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class);
        $this->commandManager = $commandManager ?? $this->objectManager->get(\TYPO3\CMS\Extbase\Mvc\Cli\CommandManager::class);
        $this->reflectionService = $reflectionService ?? $this->objectManager->get(\TYPO3\CMS\Extbase\Reflection\ReflectionService::class);
    }	
	
    /**
     * Render additional information fields within the scheduler backend.
     *
     * @param array &$taskInfo Array information of task to return
     * @param AbstractTask|null $task When editing, reference to the current task. NULL when adding.
     * @param SchedulerModuleController $schedulerModule Reference to the calling object (BE module of the Scheduler)
     * @return array Additional fields
     * @see \TYPO3\CMS\Scheduler\AdditionalFieldProvider#getAdditionalFields($taskInfo, $task, $schedulerModule)
     */
    public function getAdditionalFields(array &$taskInfo, $task, \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $schedulerModule)
    {
        $this->task = $task;
        if ($this->task !== null) {
            $this->task->setScheduler();
        }
		$argumentValues = $this->task->getArguments();
        $fields = [];
		$fields['ancext_task_description'] = $this->getCommandControllerActionDescriptionField();
		$fieldname = 'newsFilePath';
        $fields[$fieldname] = [
            'code' => '<input type="text" class="form-control" name="tx_scheduler['.self::EXT_KEY.'][arguments]['.htmlspecialchars($fieldname).']" value="' . $argumentValues[$fieldname] . '">',
            'label' => $this->languageFile.':ncIndexTtnewsPdffilesForSearchTask.field.newsFilePath',
            'cshKey' => '',
            'cshLabel' => $fieldname		
		];

        return $fields;
    }
	
    /**
     * Get description of selected command
     *
     * @return array
     */
    protected function getCommandControllerActionDescriptionField()
    {
        return [
            'code' => '',
            'label' => $this->languageFile.':ncIndexTtnewsPdffilesForSearchTask.description'
        ];
    }	
	
	public function validateAdditionalFields(array &$submittedData, \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $parentObject) 
	{
		if(is_dir($submittedData[self::EXT_KEY]['arguments']['newsFilePath']) 
			|| is_dir(\TYPO3\CMS\Core\Core\Environment::getPublicPath().'/'.$submittedData[self::EXT_KEY]['arguments']['newsFilePath']) 
			|| is_dir(\TYPO3\CMS\Core\Core\Environment::getProjectPath().'/'.$submittedData[self::EXT_KEY]['arguments']['newsFilePath'])
		) {
			return true;
		} else {
			$this->addMessage(
				$GLOBALS['LANG']->sL($this->languageFile . ':ncIndexTtnewsPdffilesForSearchTask.field.newsFilePath.error')
					.'( '.$submittedData[self::EXT_KEY]['arguments']['newsFilePath']
					.' || '.\TYPO3\CMS\Core\Core\Environment::getPublicPath().'/'.$submittedData[self::EXT_KEY]['arguments']['newsFilePath']
					.' || '.\TYPO3\CMS\Core\Core\Environment::getProjectPath().'/'.$submittedData[self::EXT_KEY]['arguments']['newsFilePath']
					.' )'
				,
				\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR
			);			
			return false;
		}
	}
	public function saveAdditionalFields(array $submittedData, \TYPO3\CMS\Scheduler\Task\AbstractTask $task) 
	{
		if(is_dir(\TYPO3\CMS\Core\Core\Environment::getPublicPath().'/'.$submittedData[self::EXT_KEY]['arguments']['newsFilePath'])) {
			$submittedData[self::EXT_KEY]['arguments']['newsFilePath'] = \TYPO3\CMS\Core\Core\Environment::getPublicPath().'/'.$submittedData[self::EXT_KEY]['arguments']['newsFilePath'];
		} else if(is_dir(\TYPO3\CMS\Core\Core\Environment::getProjectPath().'/'.$submittedData[self::EXT_KEY]['arguments']['newsFilePath'])) {
			$submittedData[self::EXT_KEY]['arguments']['newsFilePath'] = \TYPO3\CMS\Core\Core\Environment::getProjectPath().'/'.$submittedData[self::EXT_KEY]['arguments']['newsFilePath'];
		}
		$task->setCommandIdentifier($submittedData[self::EXT_KEY]['arguments']);
		$task->setArguments((array)$submittedData[self::EXT_KEY]['arguments']);
	}
}

ext_localconf.php

$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\Netzcoop\Ancext\Task\NcIndexTtnewsPdffilesForSearchTask::class] = array(
	'extension' => $_EXTKEY,
	'title' => 'LLL:EXT:'.$_EXTKEY.'/Resources/Private/Language/locallang.xlf:ncIndexTtnewsPdffilesForSearchTask.name',
	'description' => 'LLL:EXT:'.$_EXTKEY.'/Resources/Private/Language/locallang.xlf:ncIndexTtnewsPdffilesForSearchTask.description',
	'additionalFields' => \Netzcoop\Ancext\Task\NcIndexTtnewsPdffilesForSearchAdditionalFieldProvider::class
);


Backend

javascript im iframe im Backend einbinden

(Lösung von TYPO3.CMS_7.6_Schnipsel#Javascript_in_Iframe_im_Backend funzt nicht mehr )


  • ext_localconf.php
<?php 
$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects']['TYPO3\CMS\Backend\Form\FormResultCompiler'] = array(
	'className' => 'Netzcoop\Extensionsname\Form\NcFormResultCompiler'
);
  • extensionsname/Classes/Form/NcFormResultCompiler.php
<?php
namespace Netzcoop\Extensionsname\Form;

class NcFormResultCompiler extends \TYPO3\CMS\Backend\Form\FormResultCompiler {

	public function printNeededJSFunctions() {	
			
		$pageRenderer = $this->getPageRenderer();
		$pageRenderer->addJsFile('EXT:ancextensionname/Resources/Public/JavaScript/ancbackendIframe.js');
			
		return parent::printNeededJSFunctions();
	}	
}

Extensions

scheduler

über EM Local

vhs

über EM Repository

includekrexx

über EM Repository

ws_scss

git clone https://github.com/svewap/ws_scss.git

gridelements

git clone https://github.com/TYPO3-extensions/gridelements.git

t3sbootstrap

lang (Sprache)

Die Sprachkonfiguration wurde in das installtool verlegt


alte Extension Anpassungen

@inject => @TYPO3\CMS\Extbase\Annotation\Inject
@ignorevalidation => @TYPO3\CMS\Extbase\Annotation\IgnoreValidation


render Mode deprecated

<f:flashMessages renderMode="div" />
<f:flashMessages  />

htmlEscape="false" deprecated

<f:translate key="email_user_salutation" htmlEscape="false"/>
<f:translate key="email_user_salutation" />

<f:translate key="email_user_salutation" htmlEscape="false"/>,

netz.coop Extensions

anclib

ancbasic

Konfiguration:

Beispiel Seitenbaum

id:0 nctypo

  • id:1; Typ: Standard; Verhalten: Als Anfang der Website benutzen; Ressourcen: ancbasic; Erscheinungsbild > Backend-Layout ancbasic layout template; add Template enthält fluid_styled_content,gridelements, t3sbootstrap, anclib, ancbasic
    • id:2; Typ: Ordner; Name: menu_main
      • id:4: Typ: Seite; Name: Seite 1
      • id:5: Typ: Seite; Name: Seite 2
        • id:7: Typ: Seite; Name: Seite 2.1
        • id:8: Typ: Seite; Name: Seite 2.2
        • id:9: Typ: Seite; Name: Seite 2.3
      • id:6: Typ: Seite; Name: Seite 3
    • id:3; Typ: Ordner; Name: menu_footer
      • id:10: Typ: Seite; Name: Kontakt
      • id:11: Typ: Seite; Name: Impressum
      • id:12: Typ: Seite; Name: Sitemap
      • id:13: Typ: Seite; Name: Datenschutz


Speaking URLS

Site management => Sites


Source Code Änderungen - deprecated ...

@TYPO3\CMS\Extbase\Annotation\Inject not @inject


Query Builder

Klassen

use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Query\QueryBuilder;
use TYPO3\CMS\Core\Utility\GeneralUtility;

queryBuilder

$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
 ->getQueryBuilderForTable('tt_news');

FROM

$qB = $queryBuilder->from('tt_news', 'n');

WHERE

$qB->where(
      $queryBuilder->expr()->eq('pid', (int) $store_page_id)
);

$qB->andWhere(
 '  n.ncindexcontent like \'%' . $searchword . '%\' '
 );

Komplexe Abfragen

join
$qB->join(
     'n',
     'tt_news_cat_mm',
      'p2c' . $join_i,
       $queryBuilder->expr()->andX(
         $queryBuilder->expr()->eq('p2c' . $join_i . '.uid_local', $queryBuilder->quoteIdentifier('n.uid')),
         $queryBuilder->expr()->in('p2c' . $join_i . '.uid_foreign', trim(implode(",", $ORCategoriesArray),','))
        )
);


Equal
$qB->andWhere(
   $qB->expr()->eq('mm.uid_local', $uid)
);


Equal OR Equal
$qB->andWhere(
      $qB->expr()->orX(
           $qB->expr()->eq('nc.parent_category', 1),
           $qB->expr()->eq('nc.uid', 2)
      )
);


LIKE =
$qB->where(
     $qB->expr()->like(
            'email',
            $qB->createNamedParameter('%' . $qB->escapeLikeWildcards($domain) . '%')
      )
);
Limit
$qB->setMaxResults(10);
Offset
$qB->setFirstResult(20);
Select
$qB->select('*', 'n.uid as uid');


	$MysqliStatement = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\ConnectionPool::class)
	   ->getConnectionForTable('tx_scheduler_task')
	   ->select(
		  ['*'],
		  'tx_scheduler_task',
		  ['deleted' => '0']
	);	
	krexx($MysqliStatement->fetchAll());
// ACHTUNG: einmal gefetcht .. nichts mehr drinn!!!
Order By
$qB->orderBy('crdate', 'DESC');
Ausführen
$rows = $qB->execute()->fetchAll();

Count Distinct AS COUNT

 $qB->addSelectLiteral(
    $queryBuilder->expr()->count('n.uid', 'count')
);
Count Ausführen
$rows = $qB->execute()->fetch();


Wenn Querybuilder keine Option ist

Klassen

use TYPO3\CMS\Core\Database\ConnectionPool;
Individuelle SELECT Abfragen
 protected $connectionPool;
  /**
     * @param string $table
     *
     * @return \TYPO3\CMS\Core\Database\Connection
     */
    protected function getConnection(string $table)
    {
        if (empty($this->connectionPool)) {
            $this->connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
        }

        return $this->connectionPool->getConnectionForTable($table);
    }

... 

 $statement =  'SELECT * fe_users.email  from fe_users   WHERE	 activated_on>0  ORDER BY domains ASC';
 $rows= $this->getConnection('fe_users')->executeQuery($statement)->fetchAll(\PDO::FETCH_BOTH);

Probleme

#1518472189 Request parameters could not be validated (&cHash empty)

(1/1) #1518472189 TYPO3\CMS\Core\Error\Http\PageNotFoundException
Request parameters could not be validated (&cHash empty)

Lösung:

  • setup.txt
plugin.tx_ancregister.features.requireCHashArgumentForActionArguments = 0

BUGFIXES

typo3 Backend fe_users exportieren, speziell die Spalte disable

seit LTS 9 wird die Spalte disable nicht richtig gesetzt

eindeutig:
typo 8: Inaktiv [disable] => Nein wenn user aktiv

nicht eindeutig:
typo 9: Enabled [disable] => Yes wenn user aktiv (auch bei csv irreführend)


Lösung die Sprache ändern: aus disable => aktiv machen

  • EXT:ancextension/ext_localconf.php
$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['EXT:core/Resources/Private/Language/locallang_core.xlf'][] = 'EXT:ancextension/Resources/Private/Language/locallang_ancbe.xlf';
$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['EXT:frontend/Resources/Private/Language/locallang_tca.xlf'][] = 'EXT:ancextension/Resources/Private/Language/locallang_ancbe.xlf';
$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['EXT:core/Resources/Private/Language/locallang_general.xlf'][] = 'EXT:ancextension/Resources/Private/Language/locallang_ancbe.xlf';


$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][\TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList::class]['customizeCsvHeader'][] = 'Netzcoop\\Ancextension\\Hooks\\NcDatabaseRecordList->addHeaderRowToCSV';


  • EXT:ancextension/Classes/Hooks/NcDatabaseRecordList.php
<?php

namespace Netzcoop\Ancextension\Hooks;

class NcDatabaseRecordList {
	public function addHeaderRowToCSV(array &$hookParameters, \TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList $thisDatabaseRecordList) {
		if($thisDatabaseRecordList->table ==='fe_users') {
			if(is_array($hookParameters['fields']) &&  $hookParameters['fields']['disable']) {
				$hookParameters['fields']['disable'] =  $GLOBALS['LANG']->sL('LLL:EXT:ancextension/Resources/Private/Language/locallang_ancbe.xlf:LGL.enabled');
			}
		} 
	}
}
  • EXT:ancextension/Resources/Private/Language/de.locallang_ancbe.xlf
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>

<xliff version="1.0">
   <file source-language="en" datatype="plaintext" original="messages" date="2019-03-26T18:44:59Z" product-name="lang">
      <header/>
      <body>
         <trans-unit id="LGL.enabled" xml:space="preserve">
            <target>aktiviert</target>
         </trans-unit>
      </body>
   </file>
</xliff>