TYPO3 enable rte custom content element - typo3-8.x

how do I enable the Rich Text Editor for a custom content element in TYPO3 8.7?
I tried
$GLOBALS['TCA']['tt_content']['types']['myCustomElement'] = array('showitem' => '--palette--;
LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xml:palette.general;
general,header,subheader,header_link,bodytext,
richtext:rte_transform[flag=rte_enabled|mode=ts_css],rte_enabled;
image,--div--;
LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xml:tabs.appearance,--palette--;
LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xml:palette.frames;
frames,--div--;
LLL:EXT:cms/locallang_ttc.xlf:tabs.access,--palette--;
LLL:EXT:cms/locallang_ttc.xlf:palette.visibility;
visibility,--palette--;
LLL:EXT:cms/locallang_ttc.xlf:palette.access;
access,--div--;
LLL:EXT:lang/locallang_tca.xlf:sys_category.tabs.category, categories, tx_gridelements_container, tx_gridelements_columns');
and
$GLOBALS['TCA']['tt_content']['types']['myCustomElement']['columnsOverrides']['bodytext']['defaultExtras'] = 'richtext[*]:rte_transform[mode=ts_css]';
in TCA/Overrides in my Extension. What am I missing?

I have improve your code and its work properly now
$myfield=[
'showitem' => '
--palette--; LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xml:palette.general; general,header,subheader,header_link,bodytext,image,
--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xml:tabs.appearance,
--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xml:palette.frames;frames,
--div--;LLL:EXT:cms/locallang_ttc.xlf:tabs.access,
--palette--;LLL:EXT:cms/locallang_ttc.xlf:palette.visibility;visibility,
--palette--;LLL:EXT:cms/locallang_ttc.xlf:palette.access;access,
--div--;LLL:EXT:lang/locallang_tca.xlf:sys_category.tabs.category, categories, tx_gridelements_container, tx_gridelements_columns
',
'columnsOverrides' => [
'bodytext' => [
'config' => [
'enableRichtext' => true,
'richtextConfiguration' => 'default'
]
]
]
];
And
$GLOBALS['TCA']['tt_content']['types']['myCustomElement']=$myfield;
May It will help you!!

The RTE in TYPO3 comes from an TYPO3-System-Extension called rte_ckeditor. Somehow I managed to deactivate it. After reactivating it I used the following in my TCA:
$GLOBALS['TCA']['tt_content']['types']['myCustomElement'] = array('showitem' =>'--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xml:palette.general;general,header,subheader,header_link,bodytext,image,--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xml:tabs.appearance,--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xml:palette.frames;frames,--div--;LLL:EXT:cms/locallang_ttc.xlf:tabs.access,--palette--;LLL:EXT:cms/locallang_ttc.xlf:palette.visibility;visibility,--palette--;LLL:EXT:cms/locallang_ttc.xlf:palette.access;access,--div--;LLL:EXT:lang/locallang_tca.xlf:sys_category.tabs.category, categories, tx_gridelements_container, tx_gridelements_columns');
$GLOBALS['TCA']['tt_content']['types']['myCustomElement']['columnsOverrides']['bodytext']['defaultExtras'] = 'richtext[*]:rte_transform[mode=ts_css]';

Related

elementor addon getting responsive value from another control in selectors property

Hello I'm developing an Elementor plugin that I have a transform setting in my widget like this :
$repeater->add_responsive_control(
'rp_translatex_header' ,
[
'label' => esc_html('Header Translate X ') ,
'type' => \Elementor\Controls_Manager::NUMBER ,
'devices' => [ 'desktop', 'tablet', 'mobile' ],
'min' => -100,
'max' => 100,
'selectors' => [
'{{WRAPPER}} {{CURRENT_ITEM}} hth' => 'transform:translate({{VALUE}}vw,{{rp_translatey_header.VALUE}}vh)',
]
]
);
in selectors I use another control value for translateY , this work well until the responsive mode !
on mobile or tablet the translateY value that come from another control doesn't work and return the desktop value (form target control) for fixing this I should use rp_translatey_header_mobile.VALUE for getting mobile mode value !
but this is not my ideal way to fix this and I'm sure that is a way for doing this I want something like :
'selectors' => [
// for normal mode (desktop)
'{{WRAPPER}} {{CURRENT_ITEM}} div' =>
'transform:translate({{VALUE}}vw,{{rp_translatey_header.VALUE}}vh)',
// for mobile mode
'{{WRAPPER}} {{CURRENT_ITEM}} div' =>
'transform:translate({{VALUE}}vw,{{rp_translatey_header_mobile.VALUE}}vh)',
]
I can get value by {{your_control_id.VALUE}} very well by I have problem in responsive mode , {{your_control_id.VALUE}} just return the value on desktop and in mobile mode it will return desktop value again ! what should I do ? with using your_control_id_mobile the proplem will solve but i want to use all mode value ! how can i tell to control and selector in which screen use desktop and mobile
I find the solution !
i
I added two more selector and just before the {{WRAPPER}} I added (mobile ) / (tablet) /(desktop ) like this :
'selectors' => [
'(desktop){{WRAPPER}} {{CURRENT_ITEM}} div' => 'transform:translate({{rp_translatex_text.VALUE}}vw,{{VALUE}}vh)',
'(tablet){{WRAPPER}} {{CURRENT_ITEM}} div' => 'transform:translate({{rp_translatex_text_tablet.VALUE}}vw,{{VALUE}}vh)',
'(mobile){{WRAPPER}} {{CURRENT_ITEM}} div' => 'transform:translate({{rp_translatex_text_mobile.VALUE}}vw,{{VALUE}}vh)',
] ,
and for each responsive mode get the responsive id like your_id_mobile.VALUE !

Limit characters number on Ckeditor in Symfony

I'm using the Ckeditor bundle on Symfony, and I'm trying to set the characters limit for the form field with the displaying the remained chars counter.
I found information about props like "maxLength", "maxChar", "maxWord" and so on, but it not works:
$builder->add('description', CKEditorType::class, [
'config' => array(
'uiColor' => '#ffffff',
'toolbar' => [ [ "Image", "-", "Styles", "Format", "-", "Bold", "Italic", "Underline", "-", "Maximize" ] ],
'maxChar' => 2,
'showCharCount' => true
),
]);
On the official Ckeditor documentation is mentioned about a special plugin for this, but I don't know, if it works with Symfony. Does anybody know, how to set it?
Tnanks for your answers.

How to add a link to an image in Remarkup (Phabricator)

When creating wiki pages in Phabricator's Phriction, I would like to use images as links. So rather than using a normal, textual link like
[[ url | this is a link]]
I would like to use an image for the link
[[ url | {F4711} ]]
Unfortunately, Phabricator renders just the text {F4711} and not the image from the file F4711.
Is this possible with Remarkup?
Any workarounds?
I don't think it is possible in Remarkup. The official documentation doesn't mention a way to do it and I've never seen it done, unfortunately.
Maybe you can use {img https://cdn-images-1.medium.com/fit/c/72/72/1*ZroWAkaLZdsNIBOHSoez3g.jpeg}
Syntax is as follows:
{image <IMAGE_URL>}
Parameters are also supported, like:
{image uri=<IMAGE_URI>, width=500px, height=200px, alt=picture of a moose, href=google.com}
URLs without a protocol are not supported.
see more: https://secure.phabricator.com/D16597
You can add a patch in https://github.com/phacility/phabricator/blob/master/src/applications/files/markup/PhabricatorEmbedFileRemarkupRule.php#L169
like this:
$href = $file->getBestURI();
$sigil = 'lightboxable';
if (isset($options['href'])) {
$href = $options['href'];
$sigil = '';
}
$img = phutil_tag('img', $attrs);
$embed = javelin_tag(
'a',
array(
'href' => $href,
'class' => $image_class,
'sigil' => $sigil,
'meta' => array(
'phid' => $file->getPHID(),
'uri' => $file->getBestURI(),
'dUri' => $file->getDownloadURI(),
'viewable' => true,
'monogram' => $file->getMonogram(),
),
),
$img);
But in this case you cannot set the protocols:
{image uri=<IMAGE_URI>, width=500px, height=200px, alt=picture of a moose, href="//google.com"}
The reason is, phabricator renders first a a Tag with the url from the href attribiute and then the embed F Tag.

Magento Admin Chart Style

Is there anyway to change the image rendered in magento admin chart? I basically want to change the colors and shadow. Thanks
You can find the color in app/code/core/Mage/Adminhtml/Block/Graph.php in the getChartUrl() method.
$params = array(
'cht' => 'lc',
'chf' => 'bg,s,f4f4f4|c,lg,90,ffffff,0.1,ededed,0',
'chm' => 'B,f4d4b2,0,0,0',
'chco' => 'db4814'
);
f4f4f4 => color of the background
f4d4b2 => color of the line
db4814 => color of the under the line part
To change this, just rewrite this block in your own module to change this function

Set Background cell color in PHPExcel

How to set specific color to active cell when creating XLS document in PHPExcel?
$sheet->getStyle('A1')->applyFromArray(
array(
'fill' => array(
'type' => PHPExcel_Style_Fill::FILL_SOLID,
'color' => array('rgb' => 'FF0000')
)
)
);
Source: http://bayu.freelancer.web.id/2010/07/16/phpexcel-advanced-read-write-excel-made-simple/
function cellColor($cells,$color){
global $objPHPExcel;
$objPHPExcel->getActiveSheet()->getStyle($cells)->getFill()->applyFromArray(array(
'type' => PHPExcel_Style_Fill::FILL_SOLID,
'startcolor' => array(
'rgb' => $color
)
));
}
cellColor('B5', 'F28A8C');
cellColor('G5', 'F28A8C');
cellColor('A7:I7', 'F28A8C');
cellColor('A17:I17', 'F28A8C');
cellColor('A30:Z30', 'F28A8C');
This code should work for you:
$PHPExcel->getActiveSheet()
->getStyle('A1')
->getFill()
->setFillType(PHPExcel_Style_Fill::FILL_SOLID)
->getStartColor()
->setRGB('FF0000')
But if you bother using this over and over again, I recommend using applyFromArray.
Seems like there's a bug with applyFromArray right now that won't accept color, but this worked for me:
$objPHPExcel
->getActiveSheet()
->getStyle('A1')
->getFill()
->getStartColor()
->setRGB('FF0000');
This always running!
$sheet->getActiveSheet()->getStyle('A1')->getFill()->getStartColor()->setRGB('FF0000');
Here is how you do it in PHPSpreadsheet, the newest version of PHPExcel
$spreadsheet = new Spreadsheet();
$spreadsheet->getActiveSheet()->getStyle('A1:F1')->applyFromArray([
'fill' => [
'fillType' => Fill::FILL_SOLID,
'startColor' => [
'rgb' => 'FFDBE2F1',
]
],
]);
alternative approach:
$spreadsheet->getActiveSheet()
->getStyle('A1:F1')
->getFill()
->setFillType(Fill::FILL_SOLID)
->getStartColor()->setARGB('FFDBE2F1');
$objPHPExcel
->getActiveSheet()
->getStyle('A1')
->getFill()
->setFillType(PHPExcel_Style_Fill::FILL_SOLID)
->getStartColor()
->setRGB('colorcode'); //i.e,colorcode=D3D3D3
$objPHPExcel
->getActiveSheet()
->getStyle('A1')
->getFill()
->getStartColor()
->getRGB();
$objPHPExcel->getActiveSheet()->getStyle('B3:B7')->getFill()
->setFillType(PHPExcel_Style_Fill::FILL_SOLID)
->getStartColor()->setARGB('FFFF0000');
It's in the documentation, located here: https://github.com/PHPOffice/PHPExcel/wiki/User-Documentation-Overview-and-Quickstart-Guide
You can easily apply colours on cell and rows.
$sheet->cell(1, function($row)
{
$row->setBackground('#CCCCCC');
});
$sheet->row(1, ['Col 1', 'Col 2', 'Col 3']);
$sheet->row(1, function($row)
{
$row->setBackground('#CCCCCC');
});

Resources