How to add title excel in Laravel using Yajra? - laravel

How to add title when exporting to excel in Laravel using Yajra?
->parameters([
'dom' => 'Bfrtip',
'order' => [[4, "desc"]],
//'buttons' => ['excel', 'pdf', 'print'],
'buttons' => [
[
'extend' => 'excel',
'title' => "adjfadfjad"
],
[
'extend' => 'pdf'
],
[
'extend' => 'print',
'title' => "adjfadfjad"
],
],
]);
I tried adding title but it's failed, not working, how to solve that?

Add like this: title or message on top:
->parameters([
dom => 'Bfrtip',
'order' => [[4, "desc"]],
'buttons' => [
{
extend: 'excel',
messageTop: 'Title Information'}
],
]);

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'])
],

How to add spinner to select list using ajax programmatically?

I want to add spinner to select list using ajax. I have tried below code for throbber but it's not working for select list.
$form['select choice'] = [
'#type' => 'select',
'#title' => t('Choice'),
'#attributes' => [
'class' => ['js-dop-chosen'],
],
'#options' => [
'---' => t('None'),
t('choice 1'),
t('choice 2'),
],
'#ajax' => [
'event' => 'change',
'wrapper' => 'form-wrapper',
'callback' => [$this, 'ajaxCallback'],
'progress' => [
'type' => 'throbber',
'message' => 'fetching content.....',
],
],
];

Can't set Summernote Options in Backpack for Larvel 4.1

I'm attempting to set the Summernote options in Backpack for Laravel 4.1 but nothing happens when I adjust the options.
These are the variations I've tried and they seem to have no affect.
[
'type' => 'summernote',
'name' => 'description',
'options' => [['toolbar', ['font', ['bold', 'underline', 'italic']]]],
'wrapper' => [
'class' => 'form-group col-lg-12',
],
'tab' => $general
]
[
'type' => 'summernote',
'name' => 'description',
'options' => [ ['font', ['bold', 'underline', 'italic']]],
'wrapper' => [
'class' => 'form-group col-lg-12',
],
'tab' => $general
]
[
'type' => 'summernote',
'name' => 'description',
'options' => ['font', ['bold', 'underline', 'italic']],
'wrapper' => [
'class' => 'form-group col-lg-12',
],
'tab' => $general
]
The editor renders, but the editor options remain the same regardless of the options provided.
I think that the error is in the way you provide the options:
'options' => [
'placeholder'=> 'Hello stand alone ui',
'height'=> 120,
'toolbar'=>[
['style', ['style']],
['font', ['bold']], // show only bold button
['color', ['color']],
['para', ['ul', 'ol', 'paragraph']],
['table', ['table']],
['insert', ['link', 'picture', 'video']],
['view', ['fullscreen', 'codeview', 'help']]
]
for full description of the Summernote see: summernote.org

Rewrite url in yii2

How can I rewrite urls in Yii2. I want to rewrite url
/post/index?id=1
to
/post/1-example
You need to add following rules code for urlManager in config/main.php(if advance template) or web.php.
[
'components' => [
'urlManager' => [
'showScriptName' => false,
'enablePrettyUrl' => true,
'enableStrictParsing' => false,
'rules' => [
'post/<id:\d+>-example' => 'post/index',
],
],
],
]
[
'components' => [
'urlManager' => [
'showScriptName' => false,
'enablePrettyUrl' => true,
'enableStrictParsing' => false,
'rules' => [
'post/<id:\d+>-<title:\w+>' => 'post/index',
],
],
],
]
You need to add below code to your backend/config/main.php under components section:
'urlManager' => [
'class' => 'yii\web\UrlManager',
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => array(
'<controller:\w+>/<id:\d+>' => '<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
'<controller:\w+>/<action:\w+>' => '<controller>/<action>',),
],
I'd posted just because ians should be generic for all entire project.

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.

Resources