Discussion:
[TYPO3-english] FE Plugin rendered empty
Jennifer Koenig
2014-08-14 14:27:26 UTC
Permalink
I've posted this on the German forum as well under the same title. Pretty much, I've been trying for 3 days to get a simple frontend plugin working in a new installation of Typo3 6.2. Here are the relevant details:

VendorName = LAL
Extension = PackageBuilder
Plugin = PackageList
Controller = Package
Action = list

And here's the code:

fileadmin/templates/ts/setup.ts
# ...
#plugins

lib.packagePlugin = USER

lib.packagePlugin {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run

vendorName = LAL
pluginName = PackageList
extensionName = PackageBuilder

#switchableControllerActions.Package.1 = list
controller = Package
action = list

switchableControllerActions {
Package {
1 = list
}
}

settings =< plugin.tx_packagebuilder.settings
persistence =< plugin.tx_packagebuilder.persistence
view =< plugin.tx_packagebuilder.view
}



typo3conf/ext/package_builder/ext_localconf.php

/** Plugin configuration */
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'LAL'. $_EXTKEY, 'PackageList',
array('Package' => 'list'),
array('Package' => 'list')
);


typo3conf/ext/package_builder/ext_tables.php

/** Plugin registration */
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
$_EXTKEY, 'PackageList', 'Travel Packages List'
);

/** TCA mapping, configuration */

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


typo3conf/ext/package_builder/Configuration/TypoScript/setup.txt

plugin.tx_packagebuilder {
persistence {
storagePid = {$plugin.tx_packagebuilder.persistence.storagePid}
}

view {
templateRootPath = {$plugin.tx_packagebuilder.view.templateRootPath}
partialRootPath = {$plugin.tx_packagebuilder.view.partialRootPath}
layoutRootPath = {$plugin.tx_packagebuilder.view.layoutRootPath}
}
}


typo3conf/ext/package_builder/Configuration/TypoScript/constants.txt

plugin.tx_packagebuilder {
view {
templateRootPath = EXT:package_builder/Resources/Private/Templates/
partialRootPath = EXT:package_builder/Resources/Private/Partials/
layoutRootPath = EXT:package_builder/Resources/Private/Layouts/
}

persistence {
storagePid = 11,0
}
}


My PackageController has of course a listAction() method, which for now just tries to put static text out to the view (Resources/Private/Templates/Package/List.html). The controller does not seem to be called, however, as some dev-logging I put in there does not get run.

The plugin is selectable in the backend as a content element. However, when the page with this plugin is called on the frontend, the plugin will simply not render. Looking at the source code, I see this:

<!-- CONTENT ELEMENT, uid:11/list [begin] -->
<div id="c11" class="csc-default">
<!-- Plugin inserted: [begin] -->

<!-- Plugin inserted: [end] -->
</div>
<!-- CONTENT ELEMENT, uid:11/list [end] -->

The plugin is rendered empty. There is no error or warning in any kind of log. Of course, I've cleared the cache more times that I can count.

Does anyone have an idea about what the problem could be? I'm all out of ideas and getting ready to start pulling out my hair, instead. Thanks. :)
Jennifer Koenig
2014-08-15 09:05:31 UTC
Permalink
With a second pair of eyes lent by a colleage :) I was able to figure out what the problem was and solve it.

1. When you make a FE Plugin according to the steps outlined in "Reliable Extensions with Extbase and Fluid" (Joachim Rau, Sebastian Kurfurst, 2. Edition) - you don't need the Typoscript configuration that I had in fileadmin/templates/ts/setup.ts. So I erased the code I had written under the comment #plugin.

2. The plugin was still rendering empty, so I decided to go back to the Extension Builder where I had created it initially, re-generate it, and then compare any differences in relevant files, to see where the problem had been. After re-generating the extension, the only difference I could find was in ext_tables.php, namely:

OLD:
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
$_EXTKEY, 'PackageList', 'Travel Packages List'
);

NEW:
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
$_EXTKEY, 'Packagelist', 'Travel Packages List'
);

In the old file, the plugin name was in UpperCamelCase. In the new file, it isn't. So, it should be "Packagelist" and not "PackageList".

After deinstalling the original extension and reinstalling it with the changes, and embedding the plugin as a content element in the page, everything worked.

So - watch your cases when naming things in TYPO3. Apparently it's case(over)sensitive.
Loading...