Jump to content

Help needed: migrating blocktags module to PS1.5 development format


AppleEater

Recommended Posts

I'm trying to migrate the block tags module to the PS 1.5 development format.

When trying to replace the old configuration form:

 $output = '
 <form action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'" method="post">
  <fieldset>
<legend>
 <img src="'.$this->_path.'logo.gif" alt="" title="" />'.$this->l('Settings').'
</legend>
<label>'.$this->l('Tags displayed').'</label>
<div class="margin-form">
 <input type="text" name="tagsNbr" value="'.(int)(Configuration::get('BLOCKTAGS_NBR')).'" />
 <p class="clear">'.$this->l('Define the number of tags you would like displayed in this block.').'</p>
</div>
<center><input type="submit" name="submitBlockTags" value="'.$this->l('Save').'" class="button" /></center>
  </fieldset>
 </form>';
 return $output;

 

with the new one:

/* Get default Language */
 $defaultLanguage = intval(Configuration::get('PS_LANG_DEFAULT'));
 $fields_form[0]['form'] = array(
	 'legend' => array(
		 'title' => $this->l('Settings'),
  ),
  'input' => array(
array(
 'type'=> 'number',
 'label' => $this->l('Tags displayed'),
 'name' => 'tagsNbr',
 'value' => (int)(Configuration::get('BLOCKTAGS_NBR')),
 'required' => true
)
  ),
  'submit' => array(
'name' => 'submitBlockTags',
'value' => $this->l('Save'),
'class' => 'button'
  )
 );
 $helper = new HelperForm();

 // Module, Token and currentIndex
 $helper->module = $this;
 $helper->name_controller = $this->name;
 $helper->token = Tools::getAdminTokenLite('AdminModules');
 $helper->currentIndex = AdminController::$currentIndex.'&configure='.$this->name;

 // Language
  $helper->default_form_language = $default_lang;
  $helper->allow_employee_form_lang = $default_lang;

 // Title and toolbar
 $helper->title = $this->displayName; // the title for the form
 $helper->show_toolbar = true;		// false -> remove toolbar
 $helper->toolbar_scroll = true;	  // yes - > Toolbar is always visible on the top of the screen.
 $helper->submit_action = 'submit'.$this->name;
 $helper->toolbar_btn = array(
  'save' =>
	  array(
		  'desc' => $this->l('Save'),
		  'href' => AdminController::$currentIndex.'&configure='.$this->name.'&save'.$this->name,
		  '&token='.Tools::getAdminTokenLite('AdminModules')
	   ),
	 'back' =>
array(
		  'href' => AdminController::$currentIndex.'&token='.Tools::getAdminTokenLite('AdminModules'),
		  'desc' => $this->l('Back to list')
	   )
 );

 return $helper->generateForm($fields_form);

 

but getting error.

Anyone can assist?

thanks.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...