Show a list in page view in TYPO3 backend - typo3

I have a custom table that can be edited by users in List view in TYPO3 backend.
For better usability, it would be great to display that table in Page view, so they don't have to change between List view and Page view. This is possible for FE-Users (see screenshot) - so my question is: How can I have this feature for an extension table?

You can define the table in $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cms'], for example via your LocalConfiguration or AdditionalConfiguration.php file.
Add a config in that section that looks like:
'EXTCONF' => array(
'cms' => array(
'db_layout' => array(
'addTables' => array(
'fe_users' => array(
0 => array(
'MENU' => '',
'fList' => 'username,usergroup,name,email,telephone,address,zip,city',
'icon' => TRUE
)
)
)
)
)
)
Find the documentation for that feature at https://docs.typo3.org/typo3cms/CoreApiReference/ApiOverview/Examples/TablesInPageModule/Index.html

Related

How can I sort a views field created in hook_views_data_alter?

In a custom drupal 9 module I define a new field for a view within hook_views_data_alter(&$data).
$data['node']['node_views_mydata'] = array(
'title' => t('Node Views Mydata'),
'field' => array(
'title' => t('Node views mydata'),
'help' => t('Shows some data in views'),
'id' => 'node_views_mydata',
'sort' => [
'node_views_mydata' => 'default',
],
)
);
I have also defined a field plugin processing text data for this field, and can insert and output the field in views.
Now I would like to make the field sortable. But I can't do that. I always get the error "unknown column". In fact, node_views_data is not a "real" node field, but only created on the fly via the hook.
Is there nevertheless a way to sort by this column?

No dropdownmenu options in typo3 backend

I have an own extension started with extension-builder. Now I added a dropdownmenu in the backend. Unfortunately it has no entries to choose. My Configuration/TCA/Overrides/tt_content.php looks like this:
'ddOne' => array(
'label' =>'My dropdownMenu',
'exclude' => 1,
'config' => array(
'type' => 'select',
'item' => array("1","2","hier 3","option 4")
)
)
I only get an empty dropdownmenu. Thanks for your help.
You should take a look into the documentation how to correctly create a dropdown, see: https://docs.typo3.org/m/typo3/reference-tca/9.5/en-us/ColumnsConfig/Type/Select.html
renderType is missing and you need the values for your labels.

How can we add new fields in a new tab in user setting in TYPO3

How can we add new fields in a new tab in user setting in TYPO3 version 8.7?
Our problem is the creation of a new tab.
I can add new fields to personal data tab in user setting, but I need to create new fields into a new tab.
For backend admin user setting I added a new tab, but for user setting I want to try this. I have an extension and since the installation of the extension it will add-on.
I tried to create new tab in fe_user.php.
Previously I tried to change ext_tables.php, but that is not working at all.
// Add some fields to FE Users table to show TCA fields definitions
// USAGE: TCA Reference > $GLOBALS['TCA'] array reference >
// ['columns'][fieldname]['config'] / TYPE: "select"
$temporaryColumns = array (
'tx_examples_options' => array (
'exclude' => 1,
'label' => 'tx_examples_options',
'config' => array (
'type' => 'select',
'showitem' => array (
array('LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:fe_users.tx_examples_options.I.0', '1'),
array('LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:fe_users.tx_examples_options.I.1', '2'),
array('LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:fe_users.tx_examples_options.I.2', '--div--'),
array('LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:fe_users.tx_examples_options.I.3', '3'),
),
'size' => 1,
'maxitems' => 1,
)
),
'tx_examples_special' => array (
'exclude' => 1,
'label' => 'tx_examples_special',
'config' => array (
'type' => 'user',
'size' => '30',
'userFunc' => 'Documentation\\Examples\\Userfuncs\\Tca->specialField',
'parameters' => array(
'color' => 'blue'
)
)
),
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns(
'fe_users',
$temporaryColumns
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes(
'fe_users',
'--div--;newtab,tx_examples_options, tx_examples_special'
);
When I changed into file ext_tables.php
$GLOBALS['TYPO3_USER_SETTINGS']['columns']['copy_directory'] = array(
'label' => 'Alternative directory for saving copies',
'type' => 'text',
'table' => 'be_users',
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addFieldsToUserSettings('copy_directory','after:lang');
then it's showing in "personal data" tab but I want new tab in user setting for non-admin user.
In general your code looks fine.
But you are in the wrong file!
Avoid ext_tables.php if possible.
If you change anything to the TCA you should do it in Configuration/TCA/ for new tables and Configuration/TCA/Overrides for enhancing existing tables.
Use filenames according to the table you are modifying.
In your case all the code should be located in Configuration/TCA/Overrides/fe_users.php.
And be sure you clear all caches if you develop anything with TCA!

Create a subpanel to a flex related module in sugarcrm

I followed that tutorial ( http://developer.sugarcrm.com/2011/05/16/howto-create-a-flex-relate-for-other-modules/ ) to create a flex related module between the Leads and the Accounts module and PRO_Profil module.
One account can have multiple PRO_Profil items. Same for the lead module, it can have multiple PRO_Profil items. In the table pro_profil, there is a creation of parent_id and parent_name
Then I follow that tutorial ( http://developer.sugarcrm.com/2011/05/18/howto-add-a-subpanel-using-code/ ) to create a subpanel.
But the subpanel are not shown on the account detail view and neither in the lead detail view.
This result with the creation of 2 files
custom\Extension\modules\Leads\Ext\Layoutdefs_profil.php
<?php
$layout_defs["Leads"]["subpanel_setup"]['PRO_Profil'] = array (
'order' => 130,
'module' => 'PRO_Profil',
'get_subpanel_data'=>'PRO_Profil',
'sort_order' => 'asc',
'sort_by' => 'name',
'subpanel_name' => 'default',
'title_key' => 'LBL_TEST_FLEXPARENT',
);
?>
custom\Extension\modules\Leads\Ext\Vardefs\infos.php
<?php
$dictionary['Lead']['fields']['PRO_Profil'] = array(
'name' => 'PRO_Profil',
'type' => 'link',
'relationship' => 'profils_leads',
'module' => 'PRO_Profil',
'bean_name' => 'PRO_Profil',
'source' => 'non-db',
'vname' => 'LBL_TEST_FLEXPARENT',
);
?>
I have the feeling that sugarcrm 6.3 or 6.4 changed the system
where is the problem ?
regards
I tryied also :
http://forums.sugarcrm.com/f148/howto-prospect-list-subpanel-leads-sugarcem-6-4-maybe-6-3-a-78030/

Example of Zend Form with Collection Element using Forms not Fieldsets in Zend Framework2

I need a straight forward working example how I can include a collection element in Zend Form, I have seen some examples from Zend Framework 2 site and from previous posts in StackOverflow where most of them pointed to this link. But right now I am not using Fieldsets and staying with Forms, so in case if someone can direct me in the right way, how I can include a simple collection element when the user gets a page where the user can choose multiple choices from the shown collection form. Much better would be populating the collection form from database.
I have searched in the internet for quite a sometime now and thought I would post here, so that Zend profis can give their suggestions.
Just For Information:
Normally one can include a static dropdownbox in Zend Form in this fashion
$this->add(
array(
'name' => "countr",
'type' => 'Zend\Form\Element\Select',
'options' => array(
'label' => "Countries",
'options' => array(
'country1' => 'Brazil',
'country2' => 'USA',
'country3' => 'Mexico',
'country4' => 'France',
)
)
)
);
So I am expecting a simple example which could give me a basic idea how this can be done.
To be honest, I don't see your problem here. Since form collections extend Fieldset which extends Element, you can just add it to the form as a regular element. The view helpers will take care of the rendering recursively.
Step 1: Create a form collection (create an instance of Zend\Form\Element\Collection). If the elements have to be added dynamically in some way, I'd create a factory class for this purpose.
Step 2: Add it to the form. (For example using $form->add($myCollectionInstance).)
Step 3: Render it. Zend\Form\View\Helper\Collection is a pretty good view helper to render the whole form without any pain.
You can also create a new class extending Zend\Form\Element\Collection and use the constructor to add the fields you need. Thus, you can add it to the form using the array you've pasted in your question. Also, you could directly use it in annotations.
Hope this helps.
If you just want to fill in a select list with option values you can add the array to the select list in a controller:
$form = new MyForm();
$form->get('countr')->setOptions(array('value_options'=>array(
'country1' => 'Brazil',
'country2' => 'USA',
'country3' => 'Mexico',
'country4' => 'France',
));
the array can be fetched from db.
this is a different example for using form collections in the simplest way.
In this example it creates input text elements in a collection and fills them in. The number of elements depends on the array:
class MyForm extends \Zend\Form\Form
{
$this->add(array(
'type' => '\Zend\Form\Element\Collection',
'name' => 'myCollection',
'options' => array(
'label' => 'My collection',
'allow_add' => true,
)
));
}
class IndexController extends AbstractActionController
{
public function indexAction
{
$form = new MyForm();
$this->addElementsFromArray($form, array(
'country1' => 'Brazil',
'country2' => 'USA',
'country3' => 'Mexico',
'country4' => 'France',
));
//the above line can be replaced if fetching the array from a db table:
//$arrayFromDb = getArrayFromDb();
//$this->addElementsFromArray($form, $arrayFromDb);
return array(
'form' => $form
);
}
private function addElementsFromArray($form, $array)
{
foreach ($array as $key=>$value)
{
$form->get('myCollection')->add(array(
//'type' => '\Zend\Form\Element\SomeElement',
'name' => $key,
'options' => array(
'label' => $key,
),
'attributes' => array(
'value' => $value,
)
));
}
}
}
index.phtml:
$form->setAttribute('action', $this->url('home'))
->prepare();
echo $this->form()->openTag($form);
echo $this->formCollection($form->get('myCollection'));
echo $this->form()->closeTag();