Good afternoon, dear friends! All, I give up. Tried well, all that was already possible. TYPO3 7.6.16
ext_tables.php:
<?php
if (!defined('TYPO3_MODE')) die ('Access denied.');
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
'MyVendor.' . $_EXTKEY,
'Pi1',
'The inventory list'
);
ext_localconf.php:
<?php
if (!defined('TYPO3_MODE')) die ('Access denied.');
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'MyVendor.' . $_EXTKEY,
'Pi1',
Array ('Comment' => 'list'),
Array ('Comment' => 'list')
);
And constantly the same mistake
The default controller for extension "Fecomments" and plugin "Pi1" can not be determined
I read topics with same error but nothing help me.
I already climbed into the kernel, found out that $configuration ['controllerConfiguration'] is an empty array, I do not know why data does not arrive there. Comrades, help me out, I do not know what to do, honestly! )
At first, use the correct syntax for the two files. Examples:
ext_tables.php:
<?php
defined('TYPO3_MODE') || die('Access denied.');
call_user_func(
function($extKey)
{
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
'VENDOR.Extensionkey',
'Pi1',
'Extension Display Name'
);
},
$_EXTKEY
);
ext_localconf.php:
<?php
defined('TYPO3_MODE') || die('Access denied.');
call_user_func(
function($extKey)
{
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'VENDOR.' . $extKey,
'Pi1',
[
'First' => 'action1, action2'
],
// non-cacheable actions
[
'First' => ''
]
);
},
$_EXTKEY
);
The make sure the namespace and class name are fine:
typo3conf/ext/extensionkey/Classes/Controller/FirstController.php:
/***
*
* This file is part of the "extensionkey" Extension for TYPO3 CMS.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2017
*
***/
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
/**
* FilecollectorController
*/
class FirstController extends ActionController
{
/**
* action1
*
* #return void
*/
public function action1Action()
{
}
/**
* action1
*
* #return void
*/
public function action2Action()
{
}
}
Clear all caches. Sometimes it will help to go into ExtensionManager and disable/enable the whole extension. In case of changed classnames or changes in the tables/localconf files, this will flush ALL caches.
The solution provided by Mikael is not available at the moment.
Short version of the external website, that is currently offline:
Try to delete and recreate the content element on your page to delete old flexform values
Related
I have developed a custom TYPO3 extbase extension that was perfectly worked on 8 and 9 version of TYPO3.
Recently I upgraded my installation to TYPO3 10 version but the php based views of my TYPO3 extbase extension do not work anymore.
The error that is displayed is:
Sorry, the requested view was not found.
The technical reason is: No template was found. View could not be resolved for action "getIcal" in class "Luc\Lucevents2\Controller\EventController"
I have read the instructions in the page
https://docs.typo3.org/m/typo3/book-extbasefluid/10.4/en-us/8-Fluid/9-using-php-based-views.html, but there is nothing different from what I have already done in my extension.
So, I am very confused because there is no explanation why the code stopped to work, the above link doesn't include any instructions about deprecated code or possible changes after migration!!
Could you give me any help?
Thank you very much!
George
I hit this problem today. The documentation for "php based views" seems to be outdated.Below is a description of my setup and the solution for TYPO3 10
What I had:
My situation was that I had a Controller with a showAction() action method.
In typoscript, I had setup a new format through the type parameter. Something like
rss = PAGE
rss {
typeNum = 58978
10 =< tt_content.list.20.skevents_eventfeeds
}
For this type (parameter type=58978) I had setup a class named View\EventFeeds\ShowRss with a render() method.
TYPO3 automatically resolved this class based on the type (rss) and the action name (show). This does not work any more.
What solves this issue:
in order for TYPO3 to find the correct class with the render method, it is sufficient to set the defaultViewObjectName variable of the Controller to the correct class name for the specific action. This can be done in the controller with the following new method
public function initializeShowAction()
{
$this->defaultViewObjectName = \Skar\Skevents\View\EventFeeds\ShowRss::class;
}
So now, before calling the showAction method, defaultViewObjectName is set to my ShowRss class which produces the output.
Please note that my ShowRss class extends \TYPO3\CMS\Extbase\Mvc\View\AbstractView . According to https://docs.typo3.org/m/typo3/book-extbasefluid/master/en-us/8-Fluid/9-using-php-based-views.html this is deprecated in TYPO3 11 and will have to change for TYPO3 12
the static template is already included and all the other operations of the extension are working very well except the php based views. The ext_localconf.php looks as follows: <?php
defined('TYPO3_MODE') || die('Access denied.');
$boot = function () {
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'Luc.Lucevents2',
'Luceventsdisplay',
[
'Event' => 'list, show, delete, edit, monthview, test, ajax, deleteConfirm, showRss, getIcal, addForm, add, editForm, importeventtoforum',
'Channel' => 'list, show',
'Tag' => 'filter, show'
],
// non-cacheable actions
[
'Event' => 'list, show, delete, edit, monthview, test, ajax, deleteConfirm, showRss, getIcal, addForm, add, editForm, importeventtoforum',
'Channel' => 'list, show',
'Tag' => 'filter, show'
]
);
};
$boot();
unset($boot);
The action is registered in EventController.php and looks as follows:
/**
* action geticalaction
*
* #param \Luc\Lucevents2\Domain\Model\Event $event
* #return void
*/
public function getIcalAction(\Luc\Lucevents2\Domain\Model\Event $event = NULL)
{
$base_url = $this->request->getBaseUri();
$channel=$this->settings['channel_for_simple_users'];
if($this->request->hasArgument('duration'))
{
if ($this->request->getArgument('duration')=='6month') {
$duration=$this->request->getArgument('duration');
}
else
{
$duration='month';
}
$events = $this->eventRepository->get_events_for_rss_and_ical($duration,$channel);
$eventsarray= array();
foreach ($events as $obj){
$this->uriBuilder->setCreateAbsoluteUri(true);
$uri = $this->controllerContext->getUriBuilder()
->setUseCacheHash(false)
->uriFor('show', array("event" => $obj->getUid()));
$eventsarray[] = array($obj->getTitle(), $obj->getDescription(), $obj->getStartdatetime(),$obj->getEnddatetime(), $obj->getBuildingid(), $obj->getRoomid(), $obj->getPlace(), $obj->getCrdate(), $uri, $obj->getUid());
}
$this->view->assign('events', $eventsarray);
$this->view->assign('baseurl', $base_url);
}
else
{
$this->uriBuilder->setCreateAbsoluteUri(true);
$uri = $this->controllerContext->getUriBuilder()
->setUseCacheHash(false)
->uriFor('show', array("event" => $event->getUid()));
$this->view->assign('event', $event);
$this->view->assign('baseurl', $base_url);
$this->view->assign('uri', $uri);
}
}
Thank you very much!
I registered my icons in ext_localconf.php like this:
<?php
use TYPO3\CMS\Core\Imaging\IconRegistry;
$extKey = 'xxx';
if (TYPO3_MODE === 'BE') {
/** #var \TYPO3\CMS\Core\Imaging\IconRegistry $iconRegistry */
$iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(IconRegistry::class);
$iconRegistry->registerIcon(
'xxx_intro-icon-identifier',
\TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class,
['source' => 'EXT:' . $extKey . '/Resources/Public/icons/baseline-web_asset-24px.svg']
);
I want to use the iconidentifier in tt_content.php with \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPlugin() to set the icon for the drop-down menu. Who do I achieve this?
I know this solution:
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTcaSelectItem(
'tt_content',
'CType',
[
'LLL:EXT:your_extension/Resources/Private/Language/locallang_db.xlf:your_ctype.title',
'your_ctype',
'your_icon_identifier'
],
'textmedia',
'after'
);
Place this snippet in Configuration/TCA/Overrides/tt_content.php
I wanted to change the pages 'register user', 'change password' and 'user edit'.
This is not possible in the Drupal frontend, and you also have to pay a lot of attention in the code.
In forums you will usually find little help and if then rather not
satisfactory.
Therefore, I like to share my solution to save the one or other headache.
The three forms are already available from Drupal standard, if you want to change them you have to access the route and redirect.
For this you first create a module like 'my_forms'.
Second the form or a page that you want to hook into the website. e.g.
'ForgotPasswordForm'
Create a folder inside your my_forms 'Routing' and a file like 'RouteSubscriber.php'
code:
<?php
namespace Drupal\my_forms\Routing;
class RouteSubscriber extends RouteSubscriberBase{
protected function alterRoutes( RouteCollection $collection ){
//enter code here
}
}
Now you can change the route to the diffrent pages by adding following -
code:
//edit the 'forgot password' page
if ( $route = $collection->get( 'user.pass' ) ){
$route->setDefault( '_form', '\Drupal\my_forms\Form\ForgotPasswordForm' );
}
The keyword 'user.pass' allows you to change the routing. setDefault redirects the route to your own form.
//edit the 'register' page
if ( $route = $collection->get( 'user.register' ) )
{
$route->setDefaults( array(
'_title' => 'Register',
'_controller' => '\Drupal\myy_forms\Controller\LocalTaskController::offerRegistrationPage'
)
);
}
The keyword for the registration is 'user.register'. By setting the route with setDefaults you can also change the name of the link/button. In this case I used a controller to print out a normal page inside the registration. (more at the end of the post)
if ( $route = $collection->get( 'entity.user.edit_form' ) ){
//enter code here
}
For the 'user edit' page you need to use the keyword 'entity.user.edit_form'.
Last step is to clear your cashes, to register the changes in your Drupal website and refresh your page.
Load simple page with a Drupal Controller:
namespace Drupal\my_forms\Controller;
class LocalTaskController extends ControllerBase{
/** #var NodeStorage $nodeStorage */
protected $nodeStorage;
/** #var EntityViewBuilder $viewBuilder */
protected $viewBuilder;
function __construct( $nodeStorage, $viewBuilder )
{
$this->nodeStorage = $nodeStorage;
$this->viewBuilder = $viewBuilder;
}
public static function create( ContainerInterface $container )
{
$nodeStorage = $container->get( 'entity.manager' )->getStorage( 'node' );
$viewBuilder = $container->get( 'entity_type.manager' )->getViewBuilder( 'node' );
return new static( $nodeStorage, $viewBuilder );
}
public function offerRegistrationPage()
{
$node = $this->nodeStorage->load( 24 );
$renderArray = $this->viewBuilder->view( $node );
return [
'#type' => '#markup',
'#markup' => render( $renderArray ),
];
}
The '24' is the nid of the simple page, which should be displayed instead of the standard registration.
Inside my extbase extension I have an appointment model and users can write feedback to how the appointment was.
So I created a feedback model with different fields.
Now what should I implement for when the user clicks on the "Create Feedback" button?
So far I got this, but it's not working:
<f:link.action action="edit" controller="Feedback" arguments="{appointment:appointment}">
I get the the error:
Argument 1 passed to
...Controller\FeedbackController::newAction() must be an instance of
...\Model\Appointment, none given
FeedbackController:
/**
* action new
* #param ...\Domain\Model\Appointment $appointment
* #return void
*/
public function newAction(...\Domain\Model\Appointment $appointment) {
$this->view->assign('appointment', $appointment);
}
Why do I get this error? (the appointment object was definitely there, I debugged it)
I figure it must've something to do with the switch from AppointmentController to FeedbackController.
What's the best way to implement this?
You need the pluginName parameter in your link generation if you use different plugins.
<f:link.action action="edit" controller="Feedback" pluginName="your_plugin" arguments="{appointment:appointment}">
When generating a link TYPO3 prepends the "namespace" of the argument to the link like this: tx_myplugin[action]=new. Make sure, that the pluginName is the same one you defined in ext_localconf.php. In this case the pluginName would be your_plugin.
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'Vendor.' . $_EXTKEY,
'your_plugin',
array(
'Feedback' => 'new',
),
// non-cacheable actions
array(
'Feedback' => '',
)
);
Check the plugin-controller-action array in your ext_localconf.php and post it. Maybe there is something wrong.
If you get this error :
Argument 1 passed to ...Controller\FeedbackController::newAction()
must be an instance of ...\Model\Appointment, none given
it's because you give the controler a NULL object and taht's not allowed with your controller.
To avoid this error, you could allow NULL object in your controller :
/**
* action new
* #param ...\Domain\Model\Appointment $appointment
* #return void
*/
public function newAction(...\Domain\Model\Appointment $appointment=NULL) {
$this->view->assign('appointment', $appointment);
}
this is weird because in your link, you call an action 'edit' and you have an error in 'newAction' controller instead of 'editAction' controller, you should have the 'edit' action allowed for your plugin (cachable or not) :
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'Vendor.' . $_EXTKEY,
'your_plugin',
array(
'Feedback' => 'edit',
),
// non-cacheable actions
array(
'Feedback' => 'edit',
)
);
and as Natalia wrote add the plugin name if the action you want to call belongs to another plugin.
<f:link.action action="edit" controller="Feedback" pluginName="your_plugin" arguments="{appointment:appointment}">
Florian
I have no idea why, but the error just disappear without any changes. Now it works. I have not change anything. (I deleted cache many times so it cannot be because of the cache)
Problem
I created an extension using extension builder (if anyone knows any good documentation please give me link because official documentation does not have any examples).
I have a form and when I submit the form I have the error
TYPO3 v4.7
The action "formSave" (controller "Promoters") is not allowed by this plugin. Please check Tx_Extbase_Utility_Extension::configurePlugin() in your ext_localconf.php.
I created ext_localconf.php according to typo's wiki.
Form code
<f:form action="formSave" name="" object="">
<f:form.textfield id="emailResendInterval" name="emailResendInterval" value="" />
<f:form.textarea cols="30" rows="5" id="emails" name="emails" value="" />
<f:form.submit name="submit" value="Save" />
</f:form>
ext_localconf.php
<?php
if (!defined ('TYPO3_MODE')) die ('Access denied.');
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$_EXTKEY] = unserialize($_EXTCONF);
if ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$_EXTKEY]['registerSinglePlugin']) {
// fully fletged blog
Tx_Extbase_Utility_Extension::configurePlugin(
$_EXTKEY, // The extension name (in UpperCamelCase) or the extension key (in lower_underscore)
'Promoters', // A unique name of the plugin in UpperCamelCase
array ( // An array holding the controller-action-combinations that are accessible
'Promoters' => 'configuration,formSave', // The first controller and its first action will be the default
),
array( // An array of non-cachable controller-action-combinations (they must already be enabled)
)
);
} else {
Tx_Extbase_Utility_Extension::configurePlugin(
$_EXTKEY, // The extension name (in UpperCamelCase) or the extension key (in lower_underscore)
'Promoters', // A unique name of the plugin in UpperCamelCase
array ( // An array holding the controller-action-combinations that are accessible
'Promoters' => 'configuration,formSave', // The first controller and its first action will be the default
),
array( // An array of non-cachable controller-action-combinations (they must already be enabled)
)
);
PromotersControler
class Tx_Promoters_Controller_PromotersController extends Tx_Extbase_MVC_Controller_ActionController {
/**
* action configuration
*
* #return void
*/
public function configurationAction() {
}
/**
* action formSave
*
* #return void
*/
public function formSaveAction() {
}
}
Seems fine actually, I'm not sure about the if statemant in the localconf though. Please try this:
<?php
if (!defined ('TYPO3_MODE')) die ('Access denied.');
// fully fletged blog
Tx_Extbase_Utility_Extension::configurePlugin(
$_EXTKEY,
'Promoters',
array (
'Promoters' => 'configuration,formSave',
),
array(
)
);
?>