Jump to content

Using $form->addHeader(); in widget configuration


Go to solution Solved by bfarber,

Recommended Posts

I've had a custom widget where the code for the configuration-method contains a header. This works in 4.4, but in 4.5 it fails (at least when IN_DEV is active).

<?
	public function configuration( &$form=null )
	{
 		if ( $form === null )
		{
	 		$form = new \IPS\Helpers\Form;
 		}

 		$form->add(  )
		
 		$form->addHeader('livefeed_forumsettings');
		$form->add(  );
		
		return $form;
 	}


The error is: Trying to get property 'name' of non-object

And is caused by the logic in applications/core/dev/html/front/widgets/formTemplate.phtml:

{{if $input->name and \mb_substr( $input->name, 0, 12 ) != 'widget_adv__' and ! \in_array( $input->name, $visibilityFields )}}

Fixing that specific check it'll fail other places though. 

So some bugs for you to quash 🙂

For now I guess I'll just remove the form header from the form, while I await your fix, unless you want us to sectionize widget settings in a different way than this. 

Edited by TSP
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...