0

I develop a content element, which uses an image. Because it outputs the image as an inline style element: <div style="/fileadmin/_processed_/2/a/csm_article-image-1.4_a50d0b1375.jpg">[..]</div>, I want to suppress the FAL-fields alt, title, and description for the CE for the editor.

Example: screenshot

At now I use the following TypoScript :

TCEFORM {
    sys_file_reference {
        alternative.disabled = 1
        description.disabled = 1
        title.disabled = 1
        link.disabled = 1
    }

}

But this solution forces all CE to hide the file.metadata.

What does the TCA configuration look like?

Edit: The solution from @rudy-gnodde works flawlessly:

$GLOBALS['TCA']['tt_content']['types']['ce_image']['columnsOverrides']['image']['config']['overrideChildTca']['types'][0]['showitem'] = 'crop,--palette--;;filePalette';
$GLOBALS['TCA']['tt_content']['types']['ce_image']['columnsOverrides']['image']['config']['overrideChildTca']['types'][1]['showitem'] = 'crop,--palette--;;filePalette';
$GLOBALS['TCA']['tt_content']['types']['ce_image']['columnsOverrides']['image']['config']['overrideChildTca']['types'][2]['showitem'] = 'crop,--palette--;;filePalette';
$GLOBALS['TCA']['tt_content']['types']['ce_image']['columnsOverrides']['image']['config']['overrideChildTca']['types'][3]['showitem'] = 'crop,--palette--;;filePalette';
$GLOBALS['TCA']['tt_content']['types']['ce_image']['columnsOverrides']['image']['config']['overrideChildTca']['types'][4]['showitem'] = 'crop,--palette--;;filePalette';
$GLOBALS['TCA']['tt_content']['types']['ce_image']['columnsOverrides']['image']['config']['overrideChildTca']['types'][5]['showitem'] = 'crop,--palette--;;filePalette';
SimonWpt
  • 3
  • 3
  • Since Rudy Gnoddy's answer helped you, you could select it as "accepted" instead of copying his code suggestion into your question. – Ben Aug 20 '20 at 08:42
  • Your comment after "accepted" feels a bit offending. I didn't just copy his solution. I published the code for my problem based on Rudy's answer. – SimonWpt Aug 24 '20 at 06:29
  • I didn't want to offend you – your code heading ("[…] works flawlessly:") gave me the impression that it was just copied. Sorry for the the imputation. I just wanted to point out that it is fair to show appreciation to the respondent by marking a helpful answer accordingly. – Ben Aug 24 '20 at 10:40

3 Answers3

4

If you're using the existing image field, you can override which fields it should show using:

$GLOBALS['TCA']['tt_content']['columns']['image']['config']['overrideChildTca']['types'][0]['showitem'] = 'crop,--palette--;;filePalette';
$GLOBALS['TCA']['tt_content']['columns']['image']['config']['overrideChildTca']['types'][1]['showitem'] = 'crop,--palette--;;filePalette';
$GLOBALS['TCA']['tt_content']['columns']['image']['config']['overrideChildTca']['types'][2]['showitem'] = 'crop,--palette--;;filePalette';
$GLOBALS['TCA']['tt_content']['columns']['image']['config']['overrideChildTca']['types'][3]['showitem'] = 'crop,--palette--;;filePalette';
$GLOBALS['TCA']['tt_content']['columns']['image']['config']['overrideChildTca']['types'][4]['showitem'] = 'crop,--palette--;;filePalette';
$GLOBALS['TCA']['tt_content']['columns']['image']['config']['overrideChildTca']['types'][5]['showitem'] = 'crop,--palette--;;filePalette';

If it's a custom field you should add the part from overrideChildTca to the config of that field's TCA configuration.

This will only show the Image manipulation field.

Rudy Gnodde
  • 4,286
  • 2
  • 12
  • 34
  • Can you add some explanation or link to relevant parts in the documentation? This way it might be more helpful for other people in the future (and hopefully they will be able to figure out the solutions themselves). I realize the answer is old, it is just a suggestion :) – Sybille Peters Dec 21 '22 at 14:55
1

To amend existing answers, I add some explanation, links to the docs and another example for Flexform.


The Inline field type is (simplied) a 1:n relation which attaches child elements (for example files or rather sys_file_reference table elements) to a parent element (e.g. tt_content).

The TCA of the child element can be overridden with overrideChildTca. The types determines what will be displayed for the child table type.

I have a slightly different example, where a flexform element is defined as inline and has foreign_table=sys_file_reference.

But, in principle, it is the same.

So I look in existing TCA for sys_file_reference (e.g. in Configuration module in BE) and see the following:

sys_file_reference =>
 types =>
   0 =>
     showitem = --palette--;;basicoverlayPalette, --palette--;;filePalette
  ....

The basicoverlayPalette should be removed, we can see what it contains in palettes:

palettes => 
  basicoverlayPalette =>
    label = ...ce.basicoverlayPalette
    showitem = title,description

So for all types in the child TCA, we want to remove the palette basicoverlayPalette from showitem.

For Flexform this may look like this:

<overrideChildTca>
  <!-- suppress displaying title and description here -->
  <types type="array">
    <numIndex index="0" type="array">
      <showitem>--palette--;;filePalette</showitem>
    </numIndex>
    <numIndex index="1" type="array">
      <showitem>--palette--;;filePalette</showitem>
    </numIndex>
    <numIndex index="2" type="array">
      <showitem>--palette--;;filePalette</showitem>
    </numIndex>
    <numIndex index="3" type="array">
      <showitem>--palette--;;filePalette</showitem>
    </numIndex>
    <numIndex index="4" type="array">
      <showitem>--palette--;;filePalette</showitem>
    </numIndex>
    <numIndex index="5" type="array">
      <showitem>--palette--;;filePalette</showitem>
    </numIndex>
  </types>
</overrideChildTca>
Sybille Peters
  • 2,832
  • 1
  • 27
  • 49
0

You should take field "assets" instead of "image" field, assets field will give you all the data like "title,link,alt etc"

gautamsinh mori
  • 314
  • 2
  • 8
  • Thank your for the answer. I want the editor to be able to select a image in the BE. But the useless fields like title, alternative and description should not displayed in the backend. – SimonWpt Dec 10 '18 at 11:50
  • Yes If you select "file" then you can get all the fields like this : https://prnt.sc/lt1exe – gautamsinh mori Dec 10 '18 at 12:00
  • I don't want show the meta data, I want to hide them. I added a screenshot. – SimonWpt Dec 10 '18 at 12:16
  • If you want to remove it from the whole site then TCEFORM.sys_file_reference.link.disabled=1 TCEFORM.sys_file_reference.alternative.disabled=1 TCEFORM.sys_file_reference.description.disabled=1 TCEFORM.sys_file_reference.title.disabled=1 TCEFORM.sys_file_reference.description.disabled=1 – gautamsinh mori Dec 10 '18 at 12:48