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
Related
in my typo3 extension I want to add a second backend modul in navigation.
in ext_tables.php I have this:
if (TYPO3_MODE === 'BE') {
/**
* Creates a Backend Module Category
*/
$modulName = 'InstitutsShop';
//Legt die Position des Moduls fest, hier nach Modul "web"
if (!isset($TBE_MODULES[$modulName])) {
$temp_TBE_MODULES = array();
foreach ($TBE_MODULES as $key => $val) {
if ($key == 'web') {
$temp_TBE_MODULES[$key] = $val;
$temp_TBE_MODULES[$modulName] = '';
} else {
$temp_TBE_MODULES[$key] = $val;
}
}
$TBE_MODULES = $temp_TBE_MODULES;
}
// Hauptmodul erstellen
t3lib_extMgm::addModule($modulName, '', '', t3lib_extMgm::extPath($_EXTKEY) . 'Configuration/BackendModule/');
/**
* Registers a Backend Module
*/
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
'TYPO3.' . $_EXTKEY, // $extensionName => vendor + extkey, seperated by a dot
'InstitutsShop', // $mainModuleName => Make module a submodule of 'Auditgarant'
'shopbackend', // $subModuleName => module name
'', // $position => position in the group
array( // Allowed controller -> action combinations
'ShopBackend' => 'list, showOrder',
),
array( // $moduleConfiguratione
'access' => 'user,group',
'icon' => 'EXT:' . $_EXTKEY . '/ext_icon_small.svg',
'labels' => 'LLL:EXT:' . $_EXTKEY . '/Resources/Private/Language/locallang_shop_backend.xlf',
)
);
/**
* Registers a Backend Module
*/
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
'TYPO3.' . $_EXTKEY, // $extensionName => vendor + extkey, seperated by a dot
'InstitutsShop Produkte', // $mainModuleName => Make module a submodule of 'Auditgarant'
'shopbackendproducts', // $subModuleName => module name
'', // $position => position in the group
array( // Allowed controller -> action combinations
'ShopOrdProduct' => 'list',
),
array( // $moduleConfiguratione
'access' => 'user,group',
'icon' => 'EXT:' . $_EXTKEY . '/ext_icon_small.svg',
'labels' => 'LLL:EXT:' . $_EXTKEY . '/Resources/Private/Language/locallang_shop_backend.xlf',
)
);
}
The first one with controller ShopBackend is displayed ...
The second one not.
What could be the issue in this case?
Thanks in advance.
I'd say that the space is not allowed in the mainModuleName. And I don't think that your extension has the vendor TYPO3.
I am new to typo3 extension development, i have created extension with extension_builder as well as backend module too.
ext_tables.php
if (TYPO3_MODE === 'BE') {
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
'USER.Webuser',
'web', // Make module a submodule of 'web'
'bewebuser', // Submodule key
'', // Position
[
'Users' => 'list, show, new, create, edit, update, delete',
],
[
'access' => 'user,group',
'icon' => 'EXT:' . $extKey . '/Resources/Public/Icons/user_mod_bewebuser.svg',
'labels' => 'LLL:EXT:' . $extKey . '/Resources/Private/Language/locallang_bewebuser.xlf',
]
);
}
Typoscript :
# Setting up template
module.tx_webuser_web_webuserbewebuser {
persistence {
storagePid = {$module.tx_webuser_bewebuser.persistence.storagePid}
}
view {
templateRootPaths = EXT:webuser/Resources/Private/Backend/Templates/
partialRootPaths = EXT:webuser/Resources/Private/Backend/Partials/
layoutRootPaths = EXT:webuser/Resources/Private/Backend/Layouts/
}
}
Its working file. here is my BE module:
But, i want to create full area including page tree. Can anyone tell me how to remove page tree for my custom extension use? I want to use entire area for my custom extension.
Thanks an advance!
After taking a look into the source, it seems you can add the option 'navigationComponentId' => '', to the last argument of registerModule to get what you want.
Edit: 2021-02-10. For TYPO3 10 you need to additionally add 'inheritNavigationComponentFromMainModule' => false to the list. I'd assume that only applies if the main module (web in this case) has the page tree activated.
In your example it would be:
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
'USER.Webuser',
'web', // Make module a submodule of 'web'
'bewebuser', // Submodule key
'', // Position
[
'Users' => 'list, show, new, create, edit, update, delete',
],
[
'access' => 'user,group',
'icon' => 'EXT:' . $extKey . '/Resources/Public/Icons/user_mod_bewebuser.svg',
'labels' => 'LLL:EXT:' . $extKey . '/Resources/Private/Language/locallang_bewebuser.xlf',
'navigationComponentId' => '',
'inheritNavigationComponentFromMainModule' => false,
]
);
I have created a grid called 'Status' in yii2-advanced application.
I have added a custom button in backend/views/status/index.php that is working and calling respective controller action.
My customization is as follows :
[ 'class' => 'yii\grid\ActionColumn',
'template' => '{view} {update} {delete} {status/custom}',
'buttons' => [
'status/custom' => function ($url)
{
return Html::a( 'Custom', $url,
[
'title' => 'Custom',
'data-pjax' => '0',
]
);
},
],
],
Now I want that the controller action will be call using ajax without page redirect or load.
How to call actionCustom() using ajax on click Custom button?
Resolve it by using modal.
use yii\bootstrap\Modal;
use johnitvn\ajaxcrud\CrudAsset;
Html::a('Custom', ['custom'], ['role'=>'modal-remote', 'title'=>'Custom']);
In the bottom of the page..
<?php Modal::begin([
"id"=>"ajaxCrudModal",
"footer"=>"",// always need it for jquery plugin
])?>
<?php Modal::end(); ?>
In Controller
use \yii\web\Response;
In the action of controller
$request = Yii::$app->request;
if($request->isAjax){
/*
* Process for ajax request
*/
Yii::$app->response->format = Response::FORMAT_JSON;
if($request->isGet){
return [
'title'=> "Title",
'content'=>$this->renderAjax('
'model' => $yourModel
]),
'footer'=> Html::button('Close',['class'=>'btn btn-default pull-left','data-dismiss'=>"modal"]).
Html::button('Save',['class'=>'btn btn-primary','type'=>"submit"])
];
}else if($model->load($request->post()) && $model->save()){
return [
'forceReload'=>'#crud-datatable-pjax',
'title'=> "Title",
'content'=>'<span class="text-success">Textspan>',
'footer'=> Html::button('Close',['class'=>'btn btn-default pull-left','data-dismiss'=>"modal"]).
Html::a('Create new',['create', 'id'=>$id],['class'=>'btn btn-primary','role'=>'modal-remote'])
];
}else{
...
}else{
...
}
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
I am just starting Yii2 framework.
I want to create a dropdown list which is 1 to 10 and a submit button
Once select the option and click the button should go to next page to show the number I choose.
In my view file : index.php
use yii\widgets\ActiveForm;
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'QTY')->dropDownList(range(1, 10)) ?>
<?= Html::submitButton('Buy', ['class' => 'btn btn-primary']) ?>
<?php ActiveForm::end(); ?>
Then when I go to the page it gave me 'Undefined variable: model' at dropdown list there.
What should I do to make it correct?
And what is the different between Html and CHtml?
Thanks.
this code is form.php not index.php.
because we can see, there are active form.
your model is undefined maybe you write the wrong code
this is example of controller index.php
public function actionIndex()
{
$searchModel = new PersediaanBarangSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
Html and Chtml is the same
in Yii1=CHtml
in Yii2=Html
This is ment to be pagination? If yes use default functionality of the grid view.
This goes to controller:
$query = Post::find()->where(['status' => 1]);
$provider = new ActiveDataProvider([
'query' => $query,
'pagination' => [
'pageSize' => 10,
],
'sort' => [
'defaultOrder' => [
'created_at' => SORT_DESC,
'title' => SORT_ASC,
]
],
]);
return $this->render('path_to_view',['dataProvider'=>$provider]);
Read more
This goes to view:
GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
'id',
'name',
'created_at:datetime',
// ...
],
]);
Read more
Actually you model is not loaded, Please check below example.
public function actionIndex($id = Null)
{
$data=array();
$data['model'] = !empty($id) ? \app\models\YourModel::findOne($id) : new \app\models\YourModel();
return $this->render('index', $data);
}