For the title field,I want to return node.title,but what I tried is not working:
return array('og' => array('name' => 'og',
'join' => array('left' => array('table' => 'node',
'field' => 'nid'
),
'right' => array('field' => 'nid'
),
),
'fields' => array(
'title' => array('name' => t('OG: Group: Group name'),
'table' => 'node',
'handler' => 'og_handler_field_title',
'help' => t('show group name.'),
'sortable' => true,
'sort_handler' => 'views_og_query_ogname',
'notafield' => false,
),
I haven't used views for Drupal 5, so I might be a bit off. But when you make a join on the node, you shouldn't actually need to create the node title field yourself. You should instead be able get it directly from the node table like you would for a normal node.
Your field declarations should only be for the fields you have in the table you want to integrate into views.
Related
I am trying to retrieve data from "Opportunities" Reports.
This is my scenario: Opportunity module, field sales_person is a realated field from users module.
In Bids modules I have a relate field with opportunities.
During report generation, I am trying to retrieve the sales_person name in opportunities. But it is not listing in Bids report field_lists.
My dictionary in Bids
'opportunity_id_c' => array(
'required' => false,
'name' => 'opportunity_id_c',
'vname' => 'LBL_OPPORTUNITY_OPPORTUNITY_ID',
'type' => 'id',
'reportable' => true,
'calculated' => false,
'len' => 36,
'size' => '20',
),
'opportunity' => array(
'required' => false,
'source' => 'non-db',
'name' => 'opportunity',
'vname' => 'LBL_OPPORTUNITY',
'type' => 'relate',
'reportable' => true,
'unified_search' => false,
'merge_filter' => 'disabled',
'len' => '255',
'size' => '20',
'id_name' => 'opportunity_id_c',
'ext2' => 'Opportunities',
'module' => 'Opportunities',
'rname' => 'name',
'quicksearch' => 'enabled',
'studio' => 'visible',
),
Relationship:
$dictionary['Opportunity']['fields']['opportunities_procurements'] = [
'name' => 'opportunities_procurements',
'type' => 'link',
'relationship' => 'opportunities_procurements',
'module' => 'Procurement',
'bean_name' => 'Procurement',
'source' => 'non-db',
'vname' => '',
];
$dictionary['Opportunity']['relationships']['opportunities_procurements'] = [
'lhs_module' => 'Opportunities',
'lhs_table' => 'opportunities',
'lhs_key' => 'id',
'rhs_module' => 'Procurement',
'rhs_table' => 'procurement',
'rhs_key' => 'opportunity_id_c',
'relationship_type' => 'one-to-many',
];
This is what I tried: I tried to create a similar field opportunity in bids module named as opportunity_sales_userand in dictionary instead of 'rname' => 'name', I use 'rname' => 'sales_person', but I didn't get the data as the sales_person is related record.
I couldn't retrieve the vales in Reports.
How can I create a full relationship so I can get the sales_person value in Bids reports generation?
I am facing same problem so , i choose to write a simple SQL query
global $db;
$query = "Your Sql to get Reports";
$re = $db->query($query);
$data = '';
while ($row = $db->fetchByAssoc($re)) {
your code
}
I want to show a grid or editable table in my tab in the admin section
I managed to do the module and three tabs are been displayed .In one of the tab i want to show a editable grid i.e in the CHECKS tab
As shown in the below image,in the chek tab section i want to show a grid
In the constructor of my admin controller of my module ()
ie in addhealthcheckconfig\controllers\admin\HealthCheckConfigController.php
I am setting the field options to populate the tab ,below is my code:
$this->fields_options = array(
'appearance' => array(
'title' => $this->l('Manage your Health Check '),
'icon' => 'icon-html5',
'tabs' => array(
'TAB1' => $this->l('SUPPORT_GROUPS'),
'TAB2' => $this->l('CHECKS'),
'TAB3' => $this->l('REPORT RECIPIENTS'),
),
'fields' => array(
'SUPPORT_GROUPS' => array(
'title' => $this->l('SUPPORT GROUPS'),
'hint' => $this->l('Manage your Support Groups here'),
'type' => 'fields_list',
'name' => 'PS_LOGO',
'tab' => 'TAB1'
),
'CHECKS' => array(
'title' => $this->l('LIST OF AVAILABLE CHECKS '),
'hint' => $this->l('List of Available checks will be displayed here !!'),
'type' => 'text',
'list' => $this->fields_list = array(
'code' => array(
'title' => $this->l('code'),
'align' => 'text-center',
'remove_onclick' => true,
'search' => false,
),
'description' => array(
'title' => $this->l('description'),
'align' => 'text-center',
'remove_onclick' => true,
'search' => false,
),
'category' => array(
'title' => $this->l('category'),
'align' => 'text-center',
'remove_onclick' => true,
'search' => false,
),
),
'tab' => 'TAB2'
),
'REPORT_RECIPIENTS' => array(
'title' => $this->l('REPORT RECIPIENTS '),
'hint' => $this->l('List of Available checks will be displayed here !!'),
'tab' => 'TAB3'
),
) ));
In the TAB2 Section i am not sure what i need to put in the 'type' section , I tried with list , but yet I can not achieve what I am trying to do , also i am not sure how to assign the $this->fields_list to that type correctly
How to achieve this editable db grid in my tab ?
I have custom grid on my magento admin panel where I want to add product id as a css id to every select box I have tried 'column_css_class' => 'id' but this add class to every select box with id word not its value how can i do this
$this->addColumn('icon',
array(
'header' => 'Icon',
'width' => '100px',
'type' => 'action',
'getter' => 'getId',
'index' => 'stores',
'column_css_class' => 'id',
'actions' => array(
array(
'caption' => 'Enable',
'url' => array(
'base'=>'*/*/enable'
),'field' => 'id'
),
array(
'caption' => 'Disable',
'url' => array(
'base'=>'*/*/disable'
),
'field' => 'id'
)
)
));
If you have a product object says $oProduct,
You can change your code so that instead of
'column_css_class' => 'id'
You would have:
'column_css_class' => $oProduct->getId()
Also using product id is not a good idea, use SKU instead.
<?php
I have a custom CType called theme_section_columns which has children records also from the tt_content table.
The relation parent -> child is made using the field tx_theme_tt_content.
This is the configuration:
$tca = array(
.....
'types' => array(
'theme_section_columns' => array(
'showitem' => '
--palette--;LLL:EXT:cms/locallang_ttc.xlf:palette.general;general,
--palette--;LLL:EXT:cms/locallang_ttc.xlf:palette.headers;header,
tx_theme_tt_content,
--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:cms/locallang_ttc.xlf:tabs.extended,
'
),
.....
'columns' => array(
'tx_theme_tt_content' => array(
'label' => 'LLL:EXT:theme/Resources/Private/Language/Backend.xlf:content_element',
'config' => array(
'type' => 'inline',
'foreign_table' => 'tt_content',
'foreign_field' => 'tx_theme_tt_content',
'appearance' => array(
'useSortable' => TRUE,
'showSynchronizationLink' => TRUE,
'showAllLocalizationLink' => TRUE,
'showPossibleLocalizationRecords' => TRUE,
'showRemovedLocalizationRecords' => FALSE,
'expandSingle' => TRUE,
'enabledControls' => array(
'localize' => TRUE,
),
),
'behaviour' => array(
'localizationMode' => 'select',
'mode' => 'select',
'localizeChildrenAtParentLocalization' => TRUE,
),
),
),
),
),
);
Everything works as expected, except one thing. In backend list module all tt_content elements are shown, including the children of theme_section_columns.
Is there a way to hide in the list module, the content elements which have a value in tx_theme_tt_content field?
The listmod extension does what I want:
http://typo3.org/extensions/repository/view/listmod
First of all excuse my bad english.
I got a problem with my select-field in the BE. I would like to prefill (preselect) all of the available items.
Code in ext_tables.php:
'teilnehmer' => array(
'exclude' => 0,
'label' => 'LLL:EXT:kiwanisext/Resources/Private/Language/locallang_db.xlf:tx_kiwanisext_domain_model_veranstaltung.teilnehmer',
'config' => array(
'type' => 'select',
'foreign_table' => 'fe_users',
'MM' => 'tx_kiwanisext_veranstaltung_user_mm',
'size' => 10,
'autoSizeMax' => 30,
'maxitems' => 9999,
'multiple' => 0,
'wizards' => array(
'_PADDING' => 1,
'_VERTICAL' => 1,
'edit' => array(
'type' => 'popup',
'title' => 'Edit',
'script' => 'wizard_edit.php',
'icon' => 'edit2.gif',
'popup_onlyOpenIfSelected' => 1,
'JSopenParams' => 'height=350,width=580,status=0,menubar=0,scrollbars=1',
),
'add' => Array(
'type' => 'script',
'title' => 'Create new',
'icon' => 'add.gif',
'params' => array(
'table' => 'fe_users',
'pid' => '###CURRENT_PID###',
'setValue' => 'prepend'
),
'script' => 'wizard_add.php',
),
),
),
),
I found nothing helpful in the documentation.
Any hint, tip or help will be much appreciated!
Its not possible to do that with plain TCA config, afaik. You can however define a default value wich will be selected (if none is defines, 1st item will be selected).
'default' => 'myValue'
But to preselect multiple values at once, you have to use JavaScript I guess.
This code worked for me in typo3 6.2. I have a selectbox filled with database records.
I want the records with ID's 1 ans 2 to be preselected in the selectbox:
'thematique' => array(
'exclude' => 0,
'label' => 'LLL:EXT:dk_actus/locallang_db.xml:tx_dkactus_thematique',
'config' => array(
'type' => 'select',
'foreign_table' => 'tx_dkactus_thematique',
'foreign_table_where' => 'ORDER BY tx_dkactus_thematique.uid',
'size' => 10,
'minitems' => 0,
'maxitems' => 99,
'default' => '1,2',
),
),