Yii2 Kartik EditableColumn ajax post URL wont change - ajax

This is one of the column for the gridview. This is the URL it give me http://localhost/testing/apps/web/op/details/listing/particular
The URL that I wanted is
http://localhost/testing/apps/modules/op/controllers/listing/particular
I tried
'formOptions' => [ 'action' => ['/listing/particular'] ],
'formOptions' => [ 'action' => ['../listing/particular'] ],
'formOptions' => [ 'action' => ['apps/modules/op/controllers/listing/particular'] ],
The problem is no matter how I modified the URL, it just keep append whatever I typed behind http://localhost/testing/apps/web/(what i type)
Is there anyway to remove the web thing?
[
'class'=>'\kartik\grid\EditableColumn',
'attribute'=>'particular',
'editableOptions' =>
[
'inputType' => Editable::INPUT_TEXT,
'formOptions' => [ 'action' => ['listing/particular'] ],
'options' => [
]
]
],

Have you tried using yii\helpers\Url ?
use yii\helpers\Url;
Url::toRoute(['listing/particular'])

Related

Add a custom field in a custom content element by TYPO3 ver. 10.4.21

I hope anyone can help me to add a custom field for media&image element.
I create a custom content element with a extension "sitepackage builder".
I want to add a field for a media element with my new variable.
I want to add like this:
The media element should be able to upload images (e.g. jpeg, png) and audio (mp3, mp4...). It's goot if I can also add other types of media like pdf and so on which are on the picture.
I know how I can add a media element with "assets" in TCA, but then I can't use my variable.
I added two fields in TCA, a filed for media and another one for image. But then I need two variables for them. I want to use just a variable for a field which has medias and images.
This is my field for media now:
$GLOBALS['TCA']['tt_content']['columns'] = array_replace_recursive(
$GLOBALS['TCA']['tt_content']['columns'],
[
'tx_pagesaddfields_slider1_video2' => array(
'exclude' => 1,
'label' => 'Video',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
'tx_pagesaddfields_slider1_video2',
array(
'foreign_types' => array(
\TYPO3\CMS\Core\Resource\File::FILETYPE_AUDIO => array(
'showitem' => '
--palette--;;audioOverlayPalette,
--palette--;;filePalette',
),
\TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO => array(
'showitem' => '
--palette--;;videoOverlayPalette,
--palette--;;filePalette',
)
)
),
'wav,mpeg,mp4,ogg'
)
)
]
);
And this is my field for image now:
$GLOBALS['TCA']['tt_content']['columns'] = array_replace_recursive(
$GLOBALS['TCA']['tt_content']['columns'],
[
'tx_pagesaddfields_slider1_image2' => [
'exclude' => 1,
'label' => 'Image',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
'tx_pagesaddfields_slider1_image2',
[
'appearance' => [
'createNewRelationLinkTitle' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:images.addFileReference'
],
'overrideChildTca' => [
'columns' => [
'crop' => [
'description' => 'field description',
],
],
'types' => [
\TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [
'showitem' => '
--palette--;;imageoverlayPalette,
--palette--;;filePalette'
],
],
],
],
$GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
),
],
]
);
Like I've already said, I want to add just one field for media & image like this:
I've searched a lot, but I can't find the codes for that.
If you know how you can add a custom field for media&image, please answer here.
Thank you for your help.
Take a look at typo3/sysext/frontend/Configuration/TCA/tt_content.php
'assets' => [
'label' => 'LLL:EXT:frontend/Resources/Private/Language/Database.xlf:tt_content.asset_references',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig('assets', [
'appearance' => [
'createNewRelationLinkTitle' => 'LLL:EXT:frontend/Resources/Private/Language/Database.xlf:tt_content.asset_references.addFileReference'
],
// custom configuration for displaying fields in the overlay/reference table
// behaves the same as the image field.
'overrideChildTca' => [
'types' => [
'0' => [
'showitem' => '
--palette--;;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_TEXT => [
'showitem' => '
--palette--;;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [
'showitem' => '
--palette--;;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_AUDIO => [
'showitem' => '
--palette--;;audioOverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO => [
'showitem' => '
--palette--;;videoOverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_APPLICATION => [
'showitem' => '
--palette--;;imageoverlayPalette,
--palette--;;filePalette'
]
],
],
], $GLOBALS['TYPO3_CONF_VARS']['SYS']['mediafile_ext'])
],

scout:import appends numbers to elasticsearch index name

I'm using the matchish/laravel-scout-elasticsearch package and when I run php artisan scout:import on a model the index that gets created has a timestamp appended to it.
For example my config and searchableAs() method on the model returns 'groups' however the index that is created is 'groups_1632322111'. The appended timestamp updates on subsequent imports.
Is there a way to prevent the timestamp from being added?
Here is my config:
<?php
return [
'host' => env('ELASTICSEARCH_HOST'),
'indices' => [
'mappings' => [
'default' => [
'properties' => [
'id' => [
'type' => 'keyword',
],
],
],
'events' => [
'properties' => [
'id' => [
'type' => 'keyword'
]
]
],
'groups' => [
'properties' => [
'id' => [
'type' => 'keyword'
]
]
]
],
'settings' => [
'default' => [
'number_of_shards' => 1,
'number_of_replicas' => 0,
],
],
],
];

Laravel GraphQL UUID as ID does not work as expected

I'm using GraphQL in Laravel and I'm encountering this issue:
I've set id type to string but when I get my query through GraphQL, I get 553366 instead of 0553366c-6ebe-4340-8929-419ad46f4d15.
Here is my type definition:
public function fields(): array
{
return [
'id' => [
'type' => Type::string()
],
'name_en' => [
'type' => Type::string()
],
'name_fa' => [
'type' => Type::string()
],
'description' => [
'type' => Type::string()
],
'img_url' => [
'type' => Type::string()
],
'created_at' => [
'type' => Type::string()
],
'updated_at' => [
'type' => Type::string()
],
'SubBusinessFields' => [
'type' => Type::listOf(GraphQL::type('SubBusinessField'))
],
];
}
I've dd() the id and it was correct.
I've also tried id type instead of string but nothing changed.
How to fix this issue?
Just added this line to my Model and it got fixed!
public $incrementing = false;
It was weird that I couldn't find any similar problem anywhere else.

Issue setting new Yii2 theme on basic template

I have downloaded and set the theme according to the Themefactory site and other SO posts but the theme is just loading as pure html. Meaning that there is no formatting, just text and links.
This is my code in the web.php file in the config directory:
<?php
$params = require(__DIR__ . '/params.php');
$config = [
'id' => 'basic',
'basePath' => dirname(__DIR__),
'bootstrap' => ['log'],
'components' => [
'view' => [
'class' => 'yii\web\View',
'theme' => [
'class' => 'yii\base\dorian',
'pathMap' => ['#app/views' => 'themes/dorian'],
'baseUrl' => 'themes/dorian'
],
],
'request' => [
// !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
'cookieValidationKey' => 'KecrcGLWURmyPrWp3QBgYuOQ21JuCFA1',
],
'cache' => [
'class' => 'yii\caching\FileCache',
],
'user' => [
'identityClass' => 'app\models\User',
'enableAutoLogin' => true,
Screenshot of file tree: http://prntscr.com/9708gi
Does anyone see anything wrong???
try
'components' => [
'view' => [
'theme' => [
'basePath' => '#app/themes/tf-dorian',
'pathMap' => [
'#app/views' => '#app/themes/tf-dorian',
],
'baseUrl' => '#web/',
],
],
please try this and let me know if it doesn't work:
'view' => [
'class' => 'yii\web\View',
'theme' => [
'class' => 'yii\base\Theme',
'pathMap' => ['#app/views' => 'themes/tf-dorian'],
'baseUrl' => 'themes/tf-dorian'
]
]
Thanks. I figured it out. The themes directory had to go under the "web" directory.

Yii2 Advanced app, different session for frontend and backend with subdomains

I have a problem with my Yii2 app.
I have a advanced-app with frontend and backend parts on different domains (subdomain). I use webvimark user management module, but I think the problem is not in it.
Frontend app -> domain.com
Backend app -> admin.domain.com
So I have problem with login in backend, it is not working.
I enter login and password, and after submit form I see login form again.
'user' => [
'identityClass' => 'webvimark\modules\UserManagement\models\User',
'enableAutoLogin' => true,
'identityCookie' => [
'name' => '_backendIdentity',
'domain' => 'admin.domain.com',
],
'class' => 'webvimark\modules\UserManagement\components\UserConfig',
],
and
'session' => [
'name' => 'BACKENDSESSID',
'cookieParams' => [
'domain' => 'admin.domain.com',
],
],
Any ideas?
Update #1: My config located: /backend/config/main.php
Update #2: There was a problem when transferring backend on a subdomain
Okey, there was a problem with the configuration of the module, as well as the wrong config in the frontend.
Backend:
'user' => [
'identityClass' => 'webvimark\modules\UserManagement\models\User',
'enableAutoLogin' => true,
'identityCookie' => [
'name' => '_backendIdentity',
'domain' => 'backend.test.dev',
],
'class' => 'webvimark\modules\UserManagement\components\UserConfig',
'on afterLogin' => function ($event) {
\webvimark\modules\UserManagement\models\UserVisitLog::newVisitor($event->identity->id);
},
],
'session' => [
'name' => 'BACKENDSESSID',
'cookieParams' => [
'domain' => 'backend.test.dev',
],
],
Frontend:
'user' => [
'identityClass' => 'webvimark\modules\UserManagement\models\User',
'enableAutoLogin' => true,
'identityCookie' => [
'name' => '_frontendIdentity',
'path' => '/',
],
'class' => 'webvimark\modules\UserManagement\components\UserConfig',
'on afterLogin' => function ($event) {
\webvimark\modules\UserManagement\models\UserVisitLog::newVisitor($event->identity->id);
}
],
'session' => [
'name' => 'FRONTENDSESSID',
'cookieParams' => [
'path' => '/',
],
],

Resources