Skip to content

Commit

Permalink
added disable support for forms and form fields
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Kiesel committed Aug 4, 2017
1 parent 0df33b6 commit 34b192d
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 6 deletions.
38 changes: 32 additions & 6 deletions src/Resources/contao/dca/tl_css_style_selector.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,17 @@
),
'label' => array
(
'fields' => array('styleDesignation', 'cssClasses', 'articleEnabled', 'contentEnabled', 'layoutEnabled', 'moduleEnabled', 'newsEnabled', 'pageEnabled'),
'fields' => array('styleDesignation', 'cssClasses', 'articleEnabled', 'contentEnabled', 'formEnabled', 'formFieldEnabled', 'layoutEnabled', 'moduleEnabled', 'newsEnabled', 'pageEnabled'),
'showColumns' => true,
'label_callback' => function ($row, $label, DataContainer $dc, $args) {
$args[2] = $GLOBALS['TL_LANG']['MSC'][($row['disableInArticle'] ? 'no' : 'yes')];
$args[3] = $GLOBALS['TL_LANG']['MSC'][($row['disableInContent'] ? 'no' : 'yes')];
$args[4] = $GLOBALS['TL_LANG']['MSC'][($row['disableInLayout'] ? 'no' : 'yes')];
$args[5] = $GLOBALS['TL_LANG']['MSC'][($row['disableInModule'] ? 'no' : 'yes')];
$args[6] = $GLOBALS['TL_LANG']['MSC'][($row['disableInNews'] ? 'no' : 'yes')];
$args[7] = $GLOBALS['TL_LANG']['MSC'][($row['disableInPage'] ? 'no' : 'yes')];
$args[4] = $GLOBALS['TL_LANG']['MSC'][($row['disableInForm'] ? 'no' : 'yes')];
$args[5] = $GLOBALS['TL_LANG']['MSC'][($row['disableInFormField'] ? 'no' : 'yes')];
$args[6] = $GLOBALS['TL_LANG']['MSC'][($row['disableInLayout'] ? 'no' : 'yes')];
$args[7] = $GLOBALS['TL_LANG']['MSC'][($row['disableInModule'] ? 'no' : 'yes')];
$args[8] = $GLOBALS['TL_LANG']['MSC'][($row['disableInNews'] ? 'no' : 'yes')];
$args[9] = $GLOBALS['TL_LANG']['MSC'][($row['disableInPage'] ? 'no' : 'yes')];

return $args;
}
Expand Down Expand Up @@ -93,7 +95,7 @@
// Palettes
'palettes' => array
(
'default' => '{style_legend},styleDesignation;{css_legend},cssClasses;{permissions_legend},disableInArticle,disableInContent,disableInLayout,disableInModule,disableInNews,disableInPage'
'default' => '{style_legend},styleDesignation;{css_legend},cssClasses;{permissions_legend},disableInArticle,disableInContent,disableInForm,disableInFormField,disableInLayout,disableInModule,disableInNews,disableInPage'
),
// Fields
'fields' => array
Expand Down Expand Up @@ -139,6 +141,22 @@
'inputType' => 'checkbox',
'sql' => "int(1) NOT NULL default '0'"
),
'disableInForm' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_css_style_selector']['disableInForm'],
'exclude' => true,
'filter' => true,
'inputType' => 'checkbox',
'sql' => "int(1) NOT NULL default '0'"
),
'disableInFormField' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_css_style_selector']['disableInFormField'],
'exclude' => true,
'filter' => true,
'inputType' => 'checkbox',
'sql' => "int(1) NOT NULL default '0'"
),
'disableInLayout' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_css_style_selector']['disableInLayout'],
Expand Down Expand Up @@ -179,6 +197,14 @@
(
'label' => &$GLOBALS['TL_LANG']['tl_css_style_selector']['contentEnabled'],
),
'formEnabled' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_css_style_selector']['formEnabled'],
),
'formFieldEnabled' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_css_style_selector']['formFieldEnabled'],
),
'layoutEnabled' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_css_style_selector']['layoutEnabled'],
Expand Down
2 changes: 2 additions & 0 deletions src/Resources/contao/languages/de/tl_css_style_selector.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
$GLOBALS['TL_LANG']['tl_css_style_selector']['cssClasses'] = array('CSS-Klassen', 'Bitte geben Sie eine oder mehrere CSS-Klassen mit jeweils einem Leerzeichen getrennt ein.');
$GLOBALS['TL_LANG']['tl_css_style_selector']['disableInArticle'] = array('In Artikeln deaktivieren', 'Bitte wählen Sie dieses Feld aus, um den Stil in den Artikeln zu deaktivieren.');
$GLOBALS['TL_LANG']['tl_css_style_selector']['disableInContent'] = array('In Content Elementen deaktivieren', 'Bitte wählen Sie dieses Feld aus, um den Stil in den Content Elementen zu deaktivieren.');
$GLOBALS['TL_LANG']['tl_css_style_selector']['disableInForm'] = array('In Formularen deaktivieren', 'Bitte wählen Sie dieses Feld aus, um den Stil in den Formularen zu deaktivieren.');
$GLOBALS['TL_LANG']['tl_css_style_selector']['disableInFormField'] = array('In Formularfeldern deaktivieren', 'Bitte wählen Sie dieses Feld aus, um den Stil in den Formularfeldern zu deaktivieren.');
$GLOBALS['TL_LANG']['tl_css_style_selector']['disableInLayout'] = array('In Layout deaktivieren', 'Bitte wählen Sie dieses Feld aus, um den Stil in den Layouts zu deaktivieren.');
$GLOBALS['TL_LANG']['tl_css_style_selector']['disableInModule'] = array('In Modulen deaktivieren', 'Bitte wählen Sie dieses Feld aus, um den Stil in den Modulen zu deaktivieren.');
$GLOBALS['TL_LANG']['tl_css_style_selector']['disableInNews'] = array('In Neuigkeiten deaktivieren', 'Bitte wählen Sie dieses Feld aus, um den Stil in den Neuigkeiten zu deaktivieren.');
Expand Down
2 changes: 2 additions & 0 deletions src/Resources/contao/languages/en/tl_css_style_selector.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
$GLOBALS['TL_LANG']['tl_css_style_selector']['cssClasses'] = array('CSS classes', 'Please provide one or more CSS classes separated by spaces.');
$GLOBALS['TL_LANG']['tl_css_style_selector']['disableInArticle'] = array('Disable in articles', 'Choose this option if you wish to disable this style in articles.');
$GLOBALS['TL_LANG']['tl_css_style_selector']['disableInContent'] = array('Disable in content elements', 'Choose this option if you wish to disable this style in content elements.');
$GLOBALS['TL_LANG']['tl_css_style_selector']['disableInForm'] = array('Disable in forms', 'Choose this option if you wish to disable this style in forms.');
$GLOBALS['TL_LANG']['tl_css_style_selector']['disableInFormField'] = array('Disable in form fields', 'Choose this option if you wish to disable this style in form fields.');
$GLOBALS['TL_LANG']['tl_css_style_selector']['disableInLayout'] = array('Disable in page layout', 'Choose this option if you wish to disable this style in page layouts.');
$GLOBALS['TL_LANG']['tl_css_style_selector']['disableInModule'] = array('Disable in modules', 'Choose this option if you wish to disable this style in modules.');
$GLOBALS['TL_LANG']['tl_css_style_selector']['disableInNews'] = array('Disable in news', 'Choose this option if you wish to disable this style in news.');
Expand Down

0 comments on commit 34b192d

Please sign in to comment.