Skip to content

Commit

Permalink
Added the section settings UI
Browse files Browse the repository at this point in the history
  • Loading branch information
nitriques committed Jul 20, 2011
1 parent f2e368f commit 256217e
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 6 deletions.
23 changes: 21 additions & 2 deletions extension.driver.php
Expand Up @@ -113,10 +113,26 @@ public function addSectionSettings($context) {
$setting = array('checked' => 'checked');
}

// Prepare setting
$limit_value = $context['meta']['static_limit'] ? $context['meta']['static_limit'] : 1;

// Prepare setting UI
$label = new XMLElement('label');
$checkbox = new XMLElement('input', ' ' . __('Make this section static (i.e. a single entry section)'), array_merge($setting, array('name' => 'meta[static]', 'type' => 'checkbox', 'value' => 'yes')));
$checkbox = Widget::Input('meta[static]',
NULL,
'checkbox',
array_merge($setting, array('value' => 'yes')));


$textbox = Widget::Input('meta[static_limit]', $limit_value, 'text', array('style'=>'width:30px'));

$br = new XMLElement('br');
$br->setSelfClosingTag(true);

$label->appendChild($checkbox);
$label->appendChild(new XMLElement('span', ' ' . __('Make this section static (i.e. a single entry section)')));
$label->appendChild($br);
$label->appendChild(new XMLElement('span', __('You can set a maximum number of entries too')));
$label->appendChild($textbox);

// Find context
$fieldset = $context['form']->getChildren();
Expand All @@ -131,6 +147,9 @@ public function saveSectionSettings($context) {
if(!$context['meta']['static']) {
$context['meta']['static'] = 'no';
}
if (!$context['meta']['static_limit']) {
$context['meta']['static_limit'] = 1;
}
}

public function appendElementBelowView($context){
Expand Down
5 changes: 4 additions & 1 deletion lang/lang.fr.php
Expand Up @@ -18,7 +18,10 @@
$dictionary = array(

'Make this section static (i.e. a single entry section)' =>
'Rendre cette section statiques (i.e. une seule entrée)'
'Rendre cette section statiques (i.e. une seule entrée)',

'You can set a maximum number of entries too' =>
'Vous pouvez aussi définir un nombre d\'entrées maximal'

);

Expand Down
5 changes: 4 additions & 1 deletion lang/lang.it.php
Expand Up @@ -18,7 +18,10 @@
$dictionary = array(

'Make this section static (i.e. a single entry section)' =>
'Rendi statica questa sezione (potrà contenere una sola voce)'
'Rendi statica questa sezione (potrà contenere una sola voce)',

'You can set a maximum number of entries too' =>
false

);

Expand Down
5 changes: 4 additions & 1 deletion lang/lang.pt-br.php
Expand Up @@ -20,7 +20,10 @@
$dictionary = array(

'Make this section static (i.e. a single entry section)' =>
'Seção estática (exemplo, uma seção de entrada única)'
'Seção estática (exemplo, uma seção de entrada única)',

'You can set a maximum number of entries too' =>
false

);

Expand Down
5 changes: 4 additions & 1 deletion lang/lang.ro.php
Expand Up @@ -17,6 +17,9 @@
$dictionary = array(

'Make this section static (i.e. a single entry section)' =>
'Declară această secţiune statică (ex: permite o singură înregistrare)'
'Declară această secţiune statică (ex: permite o singură înregistrare)',

'You can set a maximum number of entries too' =>
false

);

0 comments on commit 256217e

Please sign in to comment.