TYPO3 Remove "Select & Upload Files" button - typo3

Removing the "Select & Upload Files" button from Page properties works with the following line in PageTSConfig:
TCEFORM.pages.media.config.appearance.fileUploadAllowed = 0
Now I want to remove the "Select & Upload Files" button within content elements (for example with CType "textmedia"), too.
I tried out several things, but with no success. I found no working PageTSConfig "rule" for this case. Does somebody know how the "Select & Upload Files" button can be removed for content elements like textmedia elements?
Using TYPO3 8.7.1

The code you use is always the same.
In PageTsConfig you have to use:
TCEFORM.[TABLE].[COLUMN].config.appearance.fileUploadAllowed = 0
In TCA you have to use:
$GLOBALS['TCA']['TABLE']['columns']['COLUMN']['config']['appearance']['fileUploadAllowed'] = 0;
You have to replace TABLE with the table you want to modify and COLUMN with the column you want to modify.
In page properties you have pages as TABLE and media as COLUMN.
In textmedia you have tt_content as TABLE and assets (i think) as COLUMN.

You can set for each field separately, see post from Kevin Appelt. In this case you need to remember for any further field in future to add this setting too.
To adapt file upload for all fields globaly, you can use UserTSConfig edit_docModuleUpload. See https://docs.typo3.org/typo3cms/TSconfigReference/singlehtml/Index.html#document-UserTsconfig/Setup/Index
To avoid file upload for all fields simple add to ext_localconf.php of your customer extension (sitepackage):
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addUserTSConfig('setup.override.edit_docModuleUpload = 0');
If you want use a separate configuration file for UserTSConfig, which I recommend add to ext_localconf.php
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addUserTSConfig('<INCLUDE_TYPOSCRIPT: source="FILE:EXT:sitepackage/Configuration/TypoScript/User/Default.ts">');
and in your extension /Configuration/TypoScript/User/Default.ts
setup.override.edit_docModuleUpload = 0
If you also want exclude file upload and folder creation in file element browser (popup window) add following code to your extension /Configuration/TypoScript/User/Default.ts
# Hide 'file upload' and 'create folder' in link- and element browser
options.folderTree.uploadFieldsInLinkBrowser = 0
options.folderTree.hideCreateFolder = 1
options.createFoldersInEB = 1

This is a very simple way to remove "Select & Upload Files" button
User settings -> Edit and Advanced functions -> File upload directly
in Doc-module(uncheck this checkbox)

Related

How to get the Log In Form on every page? (for example in footer) Typo3

Is there a way to get the Log In Form for Frontend User on every page? I would prefer the footer.
And if someone is logged in you can see the Log Out Button.
Is this possible without an extension?
You can copy the default felogin output to wherever you want on your template. For example use lib.login, copy the plugin.tx_felogin_pi1 into it, change the template and you're fine.
lib.login < plugin.tx_felogin_pi1
lib.login.templateFile = path/to/your/template/file
More you can see in the official documentation: https://docs.typo3.org/typo3cms/extensions/felogin/8.7/Configuration/Index.html
In general there are three options to include a CE (e.g. the Login-form) on all pages:
use typoscript to generate the CE. Normally the CEs are defined in tt_content, from where you could copy the base configuration and adapt it. For some plugins you also find a complete configuration beyond lib (for newer extensions there you only find the settings). All the configuration must be done in typoscript.
use typoscript to render the content of a special page/ column. In this variant you have a special page only for content referenced somewhere else. Advantage: you could configure the CE in the usual way. Try to avoid referencing CEs by uid as an editor might disable or delete the current element(s) and insert a new one which would not be rendered.
use a special column in your root page and inherit the content to all subpages. Advantage: you could change the inherited content easily on each page (if this column is available in the current backend layout).
example for 3:
variables {
footer_content < styles.content.get
footer_content.select.where = colPos = 15
footer_content.slide = -1
}

TYPO3 extension select record when including plugin as content element

How do I select an item from storage folder, when including a frontend plugin as content element?
I have made an extension (or am trying to make), that will save blocks in a folder, that can be used on several pages.
When adding a frontend plugin to a page, and selecting the extension, I want to be able to select a record that should be displayed there...
I've been trying to set up Flexforms, but still haven't got any result.
Thanks
Yes, the FlexForm is the typical place to store additional settings of inserted plugin and most comfortable for normal BE editors.
On the other hand, if you are the only one who'll administrate that page (with full admin access) and you don't need to paste this plugin more than once on the page you can also save the uid of the default record in TypoScript - setup field of the template included on the required page.
Something like
plugin.tx_yourext_pi1.initialRecordUid=123
or for Extbase
plugin.tx_yourext.settings.initialRecordUid=123
While you didn't tell us how are you gonna to create the extension, we can't help you better.
There is a content element called "insert records". Perhaps that is, what you need?
If you need your extension, just paste some code. It is easier to help then.
If you want to do it by flexform you can use following way,
<selectProperty>
<TCEforms>
<label>Select property</label>
<displayCond>FIELD:WhichPage:=:Home</displayCond>
<config>
<type>select</type>
<foreign_table>Your table name</foreign_table>
<foreign_table_where>AND (your table name.deleted = 0) AND (your table name.hidden = 0) AND (tx_wellnessproperty_property.sys_language_uid = CAST('###REC_FIELD_sys_language_uid###' AS UNSIGNED) OR sys_language_uid = '-1' ) ORDER BY your table name.uid DESC </foreign_table_where>
<size>3</size>
<minitems>0</minitems>
<maxitems>3</maxitems>
</config>
</TCEforms>
</selectProperty>
By using this flexform method you can select records individually with every plugin..

tt_news: use news title as download title in list view

My news should not contain any text, except for the title. Instead, in the list view the title should directly point to the first attached file (a PDF).
Now I thought the simplest solution for that would be to hide the title, show only the attached files and give them the title of the related news entry via TypoScript.
For the detail view this code works fine:
plugin.tt_news.newsFiles {
labelStdWrap.cObject = TEXT
labelStdWrap.cObject.dataWrap = DB:tt_news:{GPvar:tx_ttnews|tt_news}:title
labelStdWrap.cObject.wrap3 = {|}
labelStdWrap.cObject.insertData = 1
}
...but it uses the GPvar for the currently displayed news, which of course is not present in list view.
So my question is: how do I get the ID of the currently iterated news entry, if possible at all?
I am open to other solutions as well.
You will need to use custom itemMarkerArrayFunc - fastest by copying the sample into your own extension: typo3conf/ext/tt_news/res/example_itemMarkerArrayFunc.php and adding custom marker to $markerArray.
The mentioned sample even demonstrates access to files so I assume that should not be a problem to modify it for your needs.
Note: if you haven't any own ext to copy the func into it, and you don't want to create such, try to copy it somewhere under fileadmin folder, modifying files in original destination is wrong idea, cause you'll lost all changes after next tt_news' update.
Easiest solution I found is using the labelStdWrap:
plugin.tt_news.newsFiles {
labelStdWrap = TEXT
labelStdWrap.field= title
}
More options can be found here: http://typo3.org/documentation/document-library/core-documentation/doc_core_tsref/4.0.0/view/5/13/

Zend Framework Dynamically added fields of a form and populate

I have been attempting to create a form where a user can simply press a button and the form will add a new field for the user to use. I have 2 of these dynamically added field types.
Firstly a field where a user can upload files, by pressing the add button another field is pasted underneath the current field and is ready for use.
I have followed an old guide on how to get this done with a bit of ajax and jQuery.
This guide to be exact: http://www.jeremykendall.net/2009/01/19/dynamically-adding-elements-to-zend-form/
As you can see it's from 2009 and a bit outdated yet it still works under the current Zend Framework version 1.11.11
The problem however arises now that i want an edit / update version of the form. I need to populate it's fields but first of all i need to create enough fields for the data to be stored in. So when there's 3 files that have been uploaded it should create 2 additional fields and place the 3 file names in these fields ready to be edited and updated. Simply using $form->populate($stuff) is not going to work
I just have no idea how to accomplish this and the tutorial on dynamically added fields only goes as far as the addAction and not how to create the editAction under these conditions.
Is there any tutorial out there on how to create and manage forms such as these? I'm sure i am not the only one who's had the idea to builds these kind of forms?
I can add my code if there's a request for it but it's the same as the example from the guide, just a different set of elements in the form.
Adding a small example of it's use.
A user adds an item with 3 files, these files are uploaded along with a filename so in the database it appears like this : File_Id : '1' , File_Name : 'SomeFile' , File_location : 'somewhere/on/my/pc/SomeFile.txt'.
Now the user realizes he forgot a file or wants to delete a file from that list, he goes to the edit page and here i want the form to display the previously added filenames. So if there's 3 files it shows 3 and when there's 2 it shows 2 etc. How do i build a form to dynamically add fields based on the number of uploaded files and then populate them?
Any advice on how to handle this is well appreciated :)
You can make use of the semi-magic setXxx() methods of the form.
Inside the form:
public function setFiles($files) {
foreach ($files as $file) {
$this->addElement(/* add a file element */);
//do other stuff, like decorators to show the file name, etc.
}
}
In your controller:
$files = $model->getFiles();
$form = new Form_EditFiles(array('files' => $files));
By passing an array with key files you will make the form try to call the method named setFiles(), which you have conveniently provided above.
This should push you in the right direction, or so I hope at least.
If I understand you correctly you want to populate file upload fields, which is not possible because of security reasons.
Edit:
You can add Elements inside of the Controller via $form->addElement() (basicly just like the $this->addElement() statements in the Tutorial)

How to increase the size of filelinks content element in Typo3?

The content element file-links now accepts 10 files max. How to increase them ?
Typo3 Version: 4.4.8
There is an extension that solves your problem here:
http://typo3.org/extensions/repository/view/icti_ext_filelinks/current/
TYPO3 Backend Modul "Admin Tools" select "configuration".
Select "TCA" in the select box at the top. Then you can see the Typo Configuration Array.
Select (click on the small arrow) "tt_content", then "columns", then "media" then "config".
Now you can see the "maxitems". If you now click on the entry "maxitems" you will get an php code ($TCA['tt_content']['columns']['media']['config']['maxitems'] = 10;)
TYPO3 4.5 or newer: change the value and save, before 4.5 you need to do the next two steps:
Copy this code, change the value and insert into typo3conf/extTables.php
check if $typo_db_extTableDef_script = 'extTables.php'; is set in your localconf.php
Now you should be able to just change any TCA entry.
Have fun:)