Skip to content

Commit

Permalink
[BUGFIX] Since TYPO3 CMS 6.2 the 'script' configuration is deprecated…
Browse files Browse the repository at this point in the history
…, use 'module' instead.

Update: the 'select' wizard needs no 'module' configuration. See also http://docs.typo3.org/typo3cms/TCAReference/AdditionalFeatures/WizardsConfiguration/Index.html#wizards-configuration-examples-preset
Update: removed TYPO3_version check, its obsolete.
Now also Updated ColorPicker, Select, Slider and Suggest.
createComponent in AbstractFormComponent overrides the defined name in the wizard classes to 'wizard', so only one wizard was displayed.
In the add wizard the 'params' definition was missing.
See also http://docs.typo3.org/typo3cms/TCAReference/6.2/AdditionalFeatures/WizardsConfiguration/
  • Loading branch information
monosize authored and bjo3rnf committed Apr 15, 2015
1 parent 6b78094 commit 3f6512e
Show file tree
Hide file tree
Showing 11 changed files with 45 additions and 38 deletions.
4 changes: 3 additions & 1 deletion Classes/Form/AbstractFormComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,9 @@ public function createComponent($namespace, $type, $name, $label = NULL) {
/** @var FormInterface $component */
$className = $this->createComponentClassName($type, $namespace);
$component = $this->getObjectManager()->get($className);
$component->setName($name);
if (NULL === $component->getName()) {
$component->setName($name);
}
$component->setLabel($label);
$component->setLocalLanguageFileRelativePath($this->getLocalLanguageFileRelativePath());
$component->setDisableLocalLanguageLabels($this->getDisableLocalLanguageLabels());
Expand Down
6 changes: 3 additions & 3 deletions Classes/Form/AbstractWizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ abstract class AbstractWizard extends AbstractFormComponent implements WizardInt
protected $icon;

/**
* @var string
* @var array
*/
protected $script;
protected $module;

/**
* @return array
Expand All @@ -49,8 +49,8 @@ public function build() {
'type' => $this->type,
'title' => $this->getLabel(),
'icon' => $this->icon,
'script' => $this->script,
'hideParent' => intval($this->getHideParent()),
'module' => $this->module
);
$configuration = $this->buildConfiguration();
$structure = array_merge($structure, $configuration);
Expand Down
14 changes: 9 additions & 5 deletions Classes/Form/Wizard/Add.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ class Add extends AbstractWizard {
protected $icon = 'add.gif';

/**
* @var string
* @var array
*/
protected $script = 'wizard_add.php';
protected $module = array(
'name' => 'wizard_add'
);

/**
* @var string
Expand All @@ -56,9 +58,11 @@ class Add extends AbstractWizard {
*/
public function buildConfiguration() {
$configuration = array(
'table' => $this->getTable(),
'pid' => $this->getStoragePageUid(),
'setValue' => intval($this->getSetValue())
'params' => array(
'table'=> $this->getTable(),
'pid' => $this->getStoragePageUid(),
'setValue' => intval($this->getSetValue())
)
);
return $configuration;
}
Expand Down
7 changes: 4 additions & 3 deletions Classes/Form/Wizard/ColorPicker.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ class ColorPicker extends AbstractWizard {
protected $icon = 'EXT:flux/Resources/Public/Icons/ColorWheel.png';

/**
* @var string
* @var array
*/
protected $script = 'wizard_colorpicker.php';
protected $module = array(
'name' => 'wizard_colorpicker',
);

/**
* @var string
Expand All @@ -58,7 +60,6 @@ public function buildConfiguration() {
$configuration = array(
'type' => 'colorbox',
'title' => $this->getLabel(),
'script' => $this->script,
'hideParent' => intval($this->getHideParent()),
'dim' => $this->getDimensions(),
'exampleImg' => $this->getIcon(),
Expand Down
7 changes: 4 additions & 3 deletions Classes/Form/Wizard/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ class Edit extends AbstractWizard {
protected $icon = 'edit2.gif';

/**
* @var string
* @var array
*/
protected $script = 'wizard_edit.php';
protected $module = array(
'name' => 'wizard_edit'
);

/**
* @var boolean
Expand All @@ -59,7 +61,6 @@ public function buildConfiguration() {
'type' => 'popup',
'title' => $this->getLabel(),
'icon' => $this->icon,
'script' => $this->script,
'popup_onlyOpenIfSelected' => intval($this->getOpenOnlyIfSelected()),
'JSopenParams' => 'height=' . $this->getHeight() . ',width=' . $this->getWidth() . ',status=0,menubar=0,scrollbars=1'
);
Expand Down
16 changes: 9 additions & 7 deletions Classes/Form/Wizard/Link.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@ class Link extends AbstractWizard {
*/
protected $icon = 'link_popup.gif';

/**
* @var string
*/
protected $script = 'wizard_add.php';

/**
* @var string
*/
Expand Down Expand Up @@ -72,14 +67,21 @@ class Link extends AbstractWizard {
*/
public function buildConfiguration() {
$structure = array(
'script' => 'browse_links.php?mode=wizard&act=' . $this->getActiveTab(),
'JSopenParams' => 'height=' . $this->getHeight() . ',width=' . $this->getWidth() . ',status=0,menubar=0,scrollbars=1',
'params' => array(
'blindLinkOptions' => implode(',', $this->getBlindLinkOptions()),
'blindLinkFields' => implode(',', $this->getBlindLinkFields()),
'allowedExtensions' => implode(',', $this->getAllowedExtensions()),
'allowedExtensions' => implode(',', $this->getAllowedExtensions())
),
'module' => array(
'name' => 'wizard_element_browser',
'urlParameters' => array(
'mode' => 'wizard',
'act' => $this->getActiveTab()
)
)
);

return $structure;
}

Expand Down
6 changes: 4 additions & 2 deletions Classes/Form/Wizard/ListWizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ class ListWizard extends AbstractWizard {
protected $icon = 'list.gif';

/**
* @var string
* @var array
*/
protected $script = 'wizard_list.php';
protected $module = array(
'name' => 'wizard_list'
);

/**
* @var string
Expand Down
5 changes: 0 additions & 5 deletions Classes/Form/Wizard/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ class Select extends AbstractWizard {
*/
protected $icon = 'list.gif';

/**
* @var string
*/
protected $script = 'wizard_list.php';

/**
* @var string
*/
Expand Down
4 changes: 2 additions & 2 deletions Classes/Form/Wizard/Slider.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ class Slider extends AbstractWizard {
protected $icon = NULL;

/**
* @var string
* @var array
*/
protected $script = NULL;
protected $module = NULL;

/**
* @var integer
Expand Down
4 changes: 2 additions & 2 deletions Classes/Form/Wizard/Suggest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ class Suggest extends AbstractWizard {
protected $icon = NULL;

/**
* @var string
* @var array
*/
protected $script = NULL;
protected $module = NULL;

/**
* @var string
Expand Down
10 changes: 5 additions & 5 deletions Tests/Unit/Form/Field/AbstractFieldTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,9 @@ public function canBuildWithClearableFlag() {
public function modifyCreatesWizards() {
$form = Form::create();
$field = $form->createField('Input', 'testfield');
$this->assertFalse($field->has('test'));
$field->modify(array('wizards' => array('test' => array('type' => 'Add', 'name' => 'test', 'label' => 'Test'))));
$this->assertTrue($field->has('test'));
$this->assertFalse($field->has('add'));
$field->modify(array('wizards' => array('test' => array('type' => 'Add', 'name' => 'add', 'label' => 'Test'))));
$this->assertTrue($field->has('add'));
}

/**
Expand All @@ -192,8 +192,8 @@ public function modifyCreatesWizards() {
public function modifyModifiesWizards() {
$form = Form::create();
$field = $form->createField('Input', 'testfield');
$wizard = $field->createWizard('Add', 'test', 'Original label');
$field->modify(array('wizards' => array('test' => array('type' => 'Add', 'name' => 'test', 'label' => 'Test'))));
$wizard = $field->createWizard('Add', 'add', 'Original label');
$field->modify(array('wizards' => array('test' => array('type' => 'Add', 'name' => 'add', 'label' => 'Test'))));
$this->assertEquals('Test', $wizard->getLabel());
}

Expand Down

0 comments on commit 3f6512e

Please sign in to comment.