Extbase Extensions - Snippets und Glossar: Unterschied zwischen den Versionen

Aus Wikizone
Wechseln zu: Navigation, Suche
Zeile 9: Zeile 9:
 
== Snippets Links ==
 
== Snippets Links ==
 
http://typo3.org/documentation/snippets/
 
http://typo3.org/documentation/snippets/
 +
 +
== TypoScript Konfiguration im Controller nutzen ==
 +
TypoScript
 +
<pre>
 +
plugin.tx_some-extname.settings {
 +
    myXsetting = XXXX
 +
}
 +
</pre>
 +
PHP
 +
$valX = $this->settings['myXsetting'];
  
 
== E-Mails mit Extbase ==
 
== E-Mails mit Extbase ==

Version vom 10. Dezember 2014, 18:06 Uhr

Glossar

Extbase - ist ein MVC Framework für die Extension entwicklung in TYPO3

FLOW3 - ist ein PHP-Framework, welches TYPO3 Version 5 verwenden wird.

Fluid - Template Engine ähnlich wie Smarty ab Version 5


Snippets Links

http://typo3.org/documentation/snippets/

TypoScript Konfiguration im Controller nutzen

TypoScript

plugin.tx_some-extname.settings {
    myXsetting = XXXX
}

PHP

$valX = $this->settings['myXsetting'];

E-Mails mit Extbase

http://t3-developer.com/extbase-fluid/extensions-erweitern/e-mail-versand-aus-extensions/mailversand/

http://www.benny-vs-web.de/typo3/extbase-fluid-zum-rendern-von-e-mail-templates-verwenden/

Actions

Controller-Action Kombinationen für Frontend-Plugins definieren

http://docs.typo3.org/typo3cms/ExtbaseFluidBook/b-ExtbaseReference/Index.html

In ext_localconf.php sind erlaubte Actions hinterlegt. Der erste Eintrag ist die Default-Action.

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
	'Geobit.' . $_EXTKEY,
	'Mailformtest',
	array(
		'Mailform' => 'list, show, new, create',
		
	),
	// non-cacheable actions
	array(
		'Mailform' => 'create, ',
		
	)
);

Zu diesem Beispiel gehört der Controller unter

Classes/Controller/MailformController.php

Diverse

Actions anlegen

Im Controller:

/**
 * action list
 *
 * @return void
 */
public function listAction() {
	$myextname = $this->myextRepository->findAll();
	$this->view->assign('myextname', $myextname);
}

addFlashMessage

Im Controller

 $this->addFlashMessage('This is a simple success message');
 $this->addFlashMessage('The message body', 'Message title', \TYPO3\CMS\Core\Messaging\AbstractMessage::OK, TRUE);
 $this->addFlashMessage('<strong>HTML-Messageplement</strong>', '', \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR);

Default Sortierung in Extbase

Quelle: http://t3n.de/magazin/zehn-tipps-tricks-extbase-fluid-227639/2/ (11/2014)

Default-Sortierung im Repository

Nicht unbedingt unbekannt, aber weitestgehend ungenutzt ist ein Feature, welches in Extbase 1.3 hinzugekommen ist: Im Repository besteht die Möglichkeit, das Ergebnis nach bestimmten Feldern aufsteigend oder absteigend zu sortieren. Dies wird beispielsweise mittels „

$query->setOrderings(array('name' => Tx_Extbase_Persistence_QueryInterface::ORDER_DESCENDING));

erledigt.

Um dies nicht für jede einzelne Repository-Funktion einstellen zu müssen, gibt es die Eigenschaft defaultOrderings:

Im Repository

protected $defaultOrderings = array ('name' => Tx_Extbase_Persistence_QueryInterface::ORDER_DESCENDING);