TYPO3.CMS 6.2 Extension entwickeln - Backend

Aus Vosp.info
Version vom 10. April 2015, 17:14 Uhr von F (Diskussion | Beiträge) (Configuration/TCA/Overrides/be_users.php)
Wechseln zu:Navigation, Suche

typo3

Konfiguration einer Extension über den Extensionmanager

ext_conf_template.txt

diese Datei muss im Extensionangelegt werden, damit automatisch eine Konfiguration für diese angelegt wird. Zu finden ist sie im Backend unter dem Extensionmanager/Erweiterungsmanager, nach dem die Extension installiert wurde in der Zeile der Extension

# cat=basic/enable/010; type=string; label=var key: irgendein Text fürs Verständnis
var_key =

# cat=basic/enable/020; type=string; label=var secret: irgendein Text fürs Verständnis
var_secret =

php Code

$this->confArray = unserialize($GLOBALS["TYPO3_CONF_VARS"]["EXT"]["extConf"]['extension_key']);
echo '<li> -- '.$this->confArray['var_key'].'</li>';
echo '<li> -- '.$this->confArray['var_secret'].'</li>';

eine blanke Backend Seite erstellen

ext_tables.php

<?php
if (!defined('TYPO3_MODE')) {
	die('Access denied.');
}

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile($_EXTKEY, 'Configuration/TypoScript', 'Extension');



if (TYPO3_MODE === 'BE' && !(TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_INSTALL)) {
	\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
		'vendorname.' . $_EXTKEY,
		'user',
		'is24',
		'top',
		array('Auth' => 'index'),
		array(
			'access' => 'user,group',
			'icon' => 'EXT:extensionname/ext_icon.gif',
			'labels' => 'LLL:EXT:extensionname/Resources/Private/Language/locallang.xlf:title'
		)
	);
}

Classes/Controller/AuthController.php

<?php
namespace Anc\Ncimmoscout24\Controller;


/**
 * Module 'User / Group Overview' for the 'tc_beuser' extension.
 *
 * @author	netz.coop eG <kontkat[at]netz.coop>
 * @package	TYPO3
 * @subpackage	
 */
class AuthController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController {
	function indexAction() {

	}
}


Resources/Private/Language/locallang.xlf

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<xliff version="1.0">
	<file source-language="en" datatype="plaintext" original="messages" date="2015-03-24T18:35:34Z" product-name="product name">
		<header/>
		<body>
			<trans-unit id="title" xml:space="preserve">
				<_source>link name linke Spalte</_source>
			</trans-unit>			
			<trans-unit id="auth" xml:space="preserve">
				<_source>Eine Backend Seite zum gestalten</_source>
			</trans-unit>
			
		</body>
	</file>
</xliff>
  • Achtung: _source muss natürlich source heißen!!!

Resources/Private/Layouts/Default.html

<f:be.container>
	<div id="typo3-docheader">
		<div class="typo3-docheader-functions">&nbsp;</div>
		<div class="typo3-docheader-buttons">&nbsp;</div>
	</div>

	<div id="typo3-docbody">
		<div id="typo3-mod-help-about-index-php-outer">
			<f:render section="Content" />
		</div>
	</div>
</f:be.container>

Resources/Private/Partials/Auth.html

<div class="typo3-mod-help-about-index-php-inner">
	<h1>
		<f:translate key="LLL:EXT:extensionname/Resources/Private/Language/locallang.xlf:auth" />
	</h1>
	<p>
		<a href=""></a>
	</p>
</div>


Resources/Private/Templates/Auth/Index.html

<f:layout name="Default" />

<f:section name="Content">
	<f:render partial="Auth" arguments="{_all}" />
</f:section>

be_users um Spalte erweitern

Configuration/TCA/Overrides/be_users.php

<?php
if (!defined('TYPO3_MODE')) {
	die ('Access denied.');
}

// fe_users modified
$be_users_cols = array(
	'nct3_is24_username' => array(
		'label' => 'LLL:EXT:nct3_is24/locallang_tca.xml:be_users.nct3_is24_username',
		'exclude' => '1',
		'config' => array(
			'type' => 'input',
			'size' => '40',
			'eval' => 'trim,nospace,unique,alphanum_x',
			'max' => '80'			
		)
	)
);

TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('be_users', $be_users_cols);
TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCATypes('be_users', '--div--;nct3_is24,nct3_is24_username');

ext_tables.sql

CREATE TABLE be_users (
  nct3_is24_username varchar(255) DEFAULT '' NOT NULL
);

locallang_tca.xml

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<T3locallang>
	<meta type="array">
		<description>Labels for the Direct Mail tables</description>
		<type>database</type>
		<csh_table></csh_table>
		<fileId>EXT:direct_mail/locallang_tca.xml</fileId>
		<labelContext type="array">
		</labelContext>
	</meta>
	<data type="array">
		<languageKey index="default" type="array">
			<label index="be_users.nct3_is24_username">Immoscout Benutzername</label>
		</languageKey>
	</data>
</T3locallang>