Apply Light version of a font when multiple files are uploaded - mpdf

I am having an issue with applying a Light version of my font, when declaring a custom local font.
This is how I declared it:
$mpdf = new \Mpdf\Mpdf([
'fontDir' => array_merge($fontDirs, [
drupal_get_path('theme', 'my_subtheme') . '/fonts/',
]),
'fontdata' => $fontData + [
'proxima' => [
'R' => 'ProximaNovaRegular.ttf',
],
'proxima light' => [
'R' => 'ProximaNovaLight.ttf',
],
'proxima bold' => [
'R' => 'ProximaNovaBold.ttf',
]
],
'default_font' => 'proxima'
]);
But whenever I write 'proxima light' in my css the font remains regular.
I also tried with this snippet:
$mpdf = new \Mpdf\Mpdf([
'fontDir' => array_merge($fontDirs, [
drupal_get_path('theme', 'my_subtheme') . '/fonts/',
]),
'fontdata' => $fontData + [
'proxima' => [
'R' => 'ProximaNovaRegular.ttf',
'B' => 'ProximaNovaBold.ttf',
'L' => 'ProximaNovaLight.ttf',
]
],
'default_font' => 'proxima'
]);
But I don't know how to call it and I didn't find a working example on the internet.
If I only declare my Light file, then it makes everything light.
$mpdf = new \Mpdf\Mpdf([
'fontDir' => array_merge($fontDirs, [
drupal_get_path('theme', 'my_subtheme') . '/fonts/',
]),
'fontdata' => $fontData + [
'proxima' => [
'R' => 'ProximaNovaLight.ttf',
]
],
'default_font' => 'proxima'
]);
I really don't know how to continue from here, am I declaring it wrong? The problem is I need all 3 versions of the font.

Related

Not able to create locked CMS layout while plugin installation time

I'm trying to create a locked CMS layout while installing the plugin, but it's not creating a locked layout.
Here is the code,
$page = [
[
'id' => Uuid::randomHex(),
'type' => 'page',
'name' => 'Test',
'locked' => 1,
'sections' => [
[
'id' => Uuid::randomHex(),
'type' => 'default',
'locked' => 1,
'position' => 0,
'blocks' => [
[
'locked' => 1,
'position' => 0,
'type' => 'image-cover',
'slots' => [
['type' => 'image', 'locked' => 1, 'slot' => 'image']
]
]
]
]
]
]
];
Is there something that I'm missing?
Just to be clear that cms_page doesn't has locked property, but there is only a database column to set the locked layout. So you need to add it while migration or alter the table after creating a particular layout.

How to customize the title and tooltip in ux-chartjs?

I made a chart with Symfony UX and chartJs. Everything works but when I want to customize it, it become a problem and I can't find a good docs for that.
My chart is done and now I want to customize the tooltip and the title, I did like that :
$chart->setOptions([
'responsive' => true,
'title' => [
'display' => true,
'text' => 'test',
'color' => '#ce1111',
],
'tooltips' => [
'backgroundColor' => '#ce1111',
'titleColor' => '#000'
]
]);
For the title, it displays 'test' but the color doesn't work even if I replace it with titleColor.
For tooltips the backgroundColor works but not the titleColor.
Anyone has already solved this problem ?
I found it, sorry for the question but the docs is different. I post here how I dit it :
$chart->setOptions([
'responsive' => true,
'title' => [
'display' => true,
'text' => strtoupper('test'),
'fontColor' => '#ce1111',
'fontSize' => 16
//'padding' => 50
],
'tooltips' => [
'backgroundColor' => '#fff',
'bodyFontColor' => '#000',
'bodyFontSize' => 16,
],
'legend' => [
'labels' => [
'fontColor' => "#ce1111",
'fontSize' => 16
]
]
]);

WP Elementor Choose Control Prefix Class Prefixed %s String Format

I am having trouble with elementor prefix class using with CHOOSE control
Here is code snippet
$this->add_responsive_control(
'course_author_layout',
[
'label' => __('Layout', 'text-domain'),
'type' => Controls_Manager::CHOOSE,
'options' => [
'left' => [
'title' => __('Left', 'text-domain'),
'icon' => 'fa fa-long-arrow-left',
],
'up' => [
'title' => __('Center', 'text-domain'),
'icon' => 'fa fa-long-arrow-up',
],
],
'prefix_class' => 'etlms-author-layout-%s',
'default' => 'left',
]
);
Problem is here in prefix_class. In the HTML Markup prefix class is showing with %s but there should only show value.
Current scenario of class : etlms-author-layout-%sleft
Expected result of class : etlms-author-layout-left
Just remove the %s, then you will get the expected result.

ErrorException Undefined property: Illuminate\Auth\SessionGuard::$id

I have create admin in laravel. so now i want to post as a admin to database but when i did i got error like above.
i have a Post Table, I have admin id, I have admin table but it couldn't work.
// To create post
$post = new Post;
$post->title = $request->input('title');
$post->body = $request->input('body');
$post->admin_id = Auth()->guard('admin')->id;
$post->save();
I did like this above but i got error.
I also tried as
$post->admin_id = Auth()->admin()->id;
i got admin() not found.
I did Everything as per instructions but i got error.
$post->user_id = Auth()->user()->id;
Whereas this works i don't know what to do. i did everything as per instructions in Github but I have a trouble here. Please help me
Guard declaration:
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'api' => [
'driver' => 'token',
'provider' => 'users',
],
'admin' => [
'driver' => 'session',
'provider' => 'admins',
],
'admin-api' => [
'driver' => 'token',
'provider' => 'admins',
],
],
please check your code it should be like this.
auth()->id()
try with it
auth()->guard('admin')->id();

TYPO3: tx-news - localize tag, render tags multilingual, missing step

I use tx-news in a multilingual site and need to have the tags localized, (scripted from a custom extension):
1) first step: add the fields to the table:
ext_tables.sql :
#
# Extend table structure of table 'tx_news_domain_model_tag'
#
CREATE TABLE tx_news_domain_model_tag (
sys_language_uid int(11) DEFAULT '0' NOT NULL,
l10n_parent int(11) DEFAULT '0' NOT NULL,
l10n_diffsource mediumblob
);
2) second step: TCA override tag (now fully working, added 'allLanguages' selection as suggested by ralph)
Configuration/TCA/Overrides/tx_news_domain_model_tag.php
<?php
defined('TYPO3_MODE') or die();
/**
* Add multilingual to tx_news_domain_model_tag
*/
$temporaryColumns = [
'sys_language_uid' => [
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.language',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'special' => 'languages',
'items' => [
[
'LLL:EXT:lang/locallang_general.xlf:LGL.allLanguages',
-1,
'flags-multiple'
],
],
'default' => 0,
],
],
'l10n_parent' => [
'displayCond' => 'FIELD:sys_language_uid:>:0',
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.l18n_parent',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'items' => [
['', 0],
],
'foreign_table' => 'tx_news_domain_model_tag',
'foreign_table_where' => 'AND tx_news_domain_model_tag.pid=###CURRENT_PID### AND tx_news_domain_model_tag.sys_language_uid IN (-1,0)',
],
],
'l10n_diffsource' => [
'config' => [
'type' => 'passthrough',
],
],
];
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns(
'tx_news_domain_model_tag',
$temporaryColumns
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addFieldsToPalette(
'tx_news_domain_model_tag',
'paletteCore',
'sys_language_uid, l10n_parent, l10n_diffsource',
'before:hidden'
);
/* ADDED MISSING SYNTAX AFTER PAUL'S ANSWER */
$GLOBALS['TCA']['tx_news_domain_model_tag']['ctrl']['languageField'] = 'sys_language_uid';
$GLOBALS['TCA']['tx_news_domain_model_tag']['ctrl']['transOrigPointerField'] = 'l10n_parent';
$GLOBALS['TCA']['tx_news_domain_model_tag']['ctrl']['transOrigDiffSourceField'] = 'l10n_diffsource';
3) third step: TCA override news to limit tags to the language
Configuration/TCA/Overrides/tx_news_domain_model_news.php
/**
* Add This to the original **`tags`** column
*/
...
'foreign_table_where' => ' AND tx_news_domain_model_tag.sys_language_uid IN (-1, 0) ORDER BY tx_news_domain_model_tag.title',
...
4) fourth step: add the localization to the TCA of tx_news_domain_model_tag (added paul's answer to step 2, this is NOT missing anymore)
the following should be added but I don't know how ... (from a custom extension, I obviously can add it directly within 'news')
'ctrl' => [
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l10n_parent',
'transOrigDiffSourceField' => 'l10n_diffsource'
],
Did you try just to override it in the TCA array inside your Overrides/tx_news_domain_model_tag.php like this?
$GLOBALS['TCA']['tx_news_domain_model_tag']['ctrl']['languageField'] = 'sys_language_uid';
$GLOBALS['TCA']['tx_news_domain_model_tag']['ctrl']['transOrigPointerField'] = 'l10n_parent';
$GLOBALS['TCA']['tx_news_domain_model_tag']['ctrl']['transOrigDiffSourceField'] = 'l10n_diffsource';
... just one small addition. To get the option "All" in the language selector you have to change the array sys_language_uid in Configuration/TCA/Overrides/tx_news_domain_model_tag.php like this
...
'sys_language_uid' => [
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.language',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'special' => 'languages',
'items' => [
[
'LLL:EXT:lang/locallang_general.xlf:LGL.allLanguages',
-1,
'flags-multiple'
],
],
'default' => 0,
],
],
...

Resources