Recent Topics

1 Nov 22, 2017 11:38    

For one of the supported properties for $Form->begin_fieldset() is the property 'fold' => true/false.
Please can we extend support for this property to Plugins?

2 Nov 22, 2017 11:58

Supported for:

'plugin_sets' => array(
				'label' => T_('Custom Fields'),
				'note' => T_(''),
				'fold' => true,
				'type' => 'version_compare( $app_version, '6.6.5', '>' ) ? 'array:array:string' : 'array',
'entries' => array(),)

and

'block_somename_start' => array(
					'layout' => 'begin_fieldset',
					'label'  => T_('Heading'),
					'fold' => true,
				),

				// Your code here...

				'section_somename_end' => array(
					'layout' => 'end_fieldset',
				),

3 Nov 22, 2017 12:37

in inc/plugins/_plugin.funcs.php

replace

	// "Layout" settings:
	if( isset($parmeta['layout']) )
	{
		switch( $parmeta['layout'] )
		{
			case 'begin_fieldset':
				$fieldset_title = $set_label;
				$Form->begin_fieldset( $fieldset_title.$help_icon );
				break;
//....

with

	// "Layout" settings:
	if( isset($parmeta['layout']) )
	{
		switch( $parmeta['layout'] )
		{
			case 'begin_fieldset':
				$fieldset_title = $set_label;
				$Form->begin_fieldset( $fieldset_title.$help_icon, isset($parmeta['fold']) ? array( 'fold'  => $parmeta['fold'], 'deny_fold'  => isset( $parmeta['deny_fold'] ) ? $parmeta['deny_fold'] : false, 'id'  => isset( $parmeta['id'] ) ? $parmeta['id'] : $parname ) : array() );
				break;
//....

and

	case 'array':
		case 'array:integer':
		case 'array:array:integer':
		case 'array:string':
		case 'array:array:string':
		case 'array:regexp':
			$has_array_type = true;
			$has_color_field = false;

			// Always use 'fieldset' layout to display it the same way from normal and ajax calls
			$Form->switch_layout( 'fieldset' );
			if( substr_count( $parname, '[' ) % 2 )
			{ // this refers to a specific array type set (with index pos at the end), e.g. when adding a field through AJAX:
				$pos_last_bracket = strrpos($parname, '[');
				$k_nb = substr( $parname, $pos_last_bracket+1, -1 );
				$disp_arrays = array( '' => $set_value ); // empty key..
				$parname = substr($parname, 0, $pos_last_bracket);
			}
			else
			{ // display all values hold in this set:
				$disp_whole_set = true;
				$disp_arrays = $set_value;
				$fieldset_title = $set_label;
				if( $debug )
				{
					$fieldset_title .= ' [debug: '.$parname.']';
				}
				$Form->begin_fieldset( $fieldset_title );

with

	case 'array':
		case 'array:integer':
		case 'array:array:integer':
		case 'array:string':
		case 'array:array:string':
		case 'array:regexp':
			$has_array_type = true;
			$has_color_field = false;

			// Always use 'fieldset' layout to display it the same way from normal and ajax calls
			$Form->switch_layout( 'fieldset' );
			if( substr_count( $parname, '[' ) % 2 )
			{ // this refers to a specific array type set (with index pos at the end), e.g. when adding a field through AJAX:
				$pos_last_bracket = strrpos($parname, '[');
				$k_nb = substr( $parname, $pos_last_bracket+1, -1 );
				$disp_arrays = array( '' => $set_value ); // empty key..
				$parname = substr($parname, 0, $pos_last_bracket);
			}
			else
			{ // display all values hold in this set:
				$disp_whole_set = true;
				$disp_arrays = $set_value;
				$fieldset_title = $set_label;
				if( $debug )
				{
					$fieldset_title .= ' [debug: '.$parname.']';
				}
				$Form->begin_fieldset( $fieldset_title, isset($parmeta['fold']) ? array( 'fold'  => $parmeta['fold'], 'deny_fold'  => isset( $parmeta['deny_fold'] ) ? $parmeta['deny_fold'] : false, 'id'  => isset( $parmeta['id'] ) ? $parmeta['id'] : $parname ) : array() );

completes the implementation

https://github.com/b2evolution/b2evolution/pull/54/files#diff-6a349809c4639c2880536ebbd9cfe12d

5 Dec 02, 2017 02:26

will be in next version

This post has 1 feedback awaiting moderation...


Form is loading...