[request] html on blockcontactinfos



  • how about adding the possibility to use HTML on blockcontactinfos?

    it can be very useful for the “address” field to format it in a decent way or at least add a <br/> on it.





  • I tried the second solution without success, in first one the code a little different from the TB one.



  • Hi,

    Really easy, in fact, it’s already a HTML block for the address field, the field is a texarea, and you can extend the field by draging the coner.
    When saving, an “HTML clean filter” remove HTML tag.
    When displaying, another filter transform HTML tag in clean characters.

    To remove these filters, 2 modify to add:

    1. in modules\blockcontactinfos\blockcontactinfos.php, line 72, replace the getContent() function by :
      (just add “true” paramater to say it’s some html you what to save)
    	public function getContent()
    	{
    		$html = '';
    		if (Tools::isSubmit('submitModule'))
    		{
    			foreach (Blockcontactinfos::$contact_fields as $field)
    				Configuration::updateValue($field, Tools::getValue($field), true);
    			$this->_clearCache('blockcontactinfos.tpl');
    			$html = $this->displayConfirmation($this->l('Configuration updated'));
    		}
            }
    
    1. in themes\community-theme-default\modules\blockcontactinfos\blockcontactinfos.tpl, remove HTML filter with that:
    {$blockcontactinfos_address nofilter}
    

    If you need more texarea for other fiels, just replace the type field in renderForm() by:

    'type' => 'textarea',
    

    Should works,
    Regards.



  • Thank you @Lathaneo

    Can I ask you why the fixes (linked above) I found weren’t working?

    I read this too:
    https://www.smarty.net/docsv2/en/language.modifier.nl2br.tpl



  • Hi,
    For the first one, he add nl2br filter, just transform the \n in <br>.
    Like he explained, it’s should working, except if you add some HTML. In the case you add some HTML tags, you have to specify ‘nofilter’ for not transforning HTML Tags.

    Second link, it’s the same.

    Regards.



  • I didn’t add any HTML TAG, I simply write it the paragraph with new line but in the footer the new like was stripped out.

    I still not used your solution, it didn’t low down security enabling full HTML?



  • Hi,

    It could be unsecure from trivial user, but like it’s you who is writing the saved datas, it’s ok.
    For example, don’t remove HTML filter for datas from message boxes for the service after sale.

    Regards.


 

Looks like your connection to thirty bees forum was lost, please wait while we try to reconnect.