Skip to content

Commit

Permalink
Added support for allowed fields for backend users
Browse files Browse the repository at this point in the history
  • Loading branch information
ausi committed Aug 6, 2014
1 parent 870881e commit d2626a2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions dca/tl_content.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
$GLOBALS['TL_DCA']['tl_content']['config']['onsubmit_callback'][] = array('MadeYourDay\Contao\CustomElements', 'onsubmitCallback');
$GLOBALS['TL_DCA']['tl_content']['fields']['rsce_data'] = array(
'label' => &$GLOBALS['TL_LANG']['tl_content']['rsce_data'],
'exclude' => true,
'inputType' => 'rsce_list_hidden',
'sql' => "mediumblob NULL",
'save_callback' => array(
Expand Down
1 change: 1 addition & 0 deletions dca/tl_module.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
$GLOBALS['TL_DCA']['tl_module']['config']['onsubmit_callback'][] = array('MadeYourDay\Contao\CustomElements', 'onsubmitCallback');
$GLOBALS['TL_DCA']['tl_module']['fields']['rsce_data'] = array(
'label' => &$GLOBALS['TL_LANG']['tl_module']['rsce_data'],
'exclude' => true,
'inputType' => 'rsce_list_hidden',
'sql' => "mediumblob NULL",
'save_callback' => array(
Expand Down
7 changes: 7 additions & 0 deletions src/MadeYourDay/Contao/CustomElements.php
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,13 @@ protected function createDcaItem($fieldPrefix, $fieldName, $fieldConfig, &$palet
);
}

if (
!\BackendUser::getInstance()->hasAccess($dc->table . '::rsce_data', 'alexf')
&& $fieldConfig['inputType'] !== 'standardField'
) {
return;
}

if (isset($fieldConfig['label'])) {
$fieldConfig['label'] = static::getLabelTranslated($fieldConfig['label']);
}
Expand Down

0 comments on commit d2626a2

Please sign in to comment.