forked from Public/pics
		
	InlineFormView: combine fields and buttons into one 'controls' array
This commit is contained in:
		
							parent
							
								
									0274ff5bf4
								
							
						
					
					
						commit
						77fa33730a
					
				@ -25,7 +25,7 @@ class ManageAssets extends HTMLController
 | 
			
		||||
				'method' => 'post',
 | 
			
		||||
				'class' => 'col-md-6 text-end',
 | 
			
		||||
				'is_embed' => true,
 | 
			
		||||
				'buttons' => [
 | 
			
		||||
				'controls' => [
 | 
			
		||||
					'deleteChecked' => [
 | 
			
		||||
						'type' => 'submit',
 | 
			
		||||
						'caption' => 'Delete checked',
 | 
			
		||||
 | 
			
		||||
@ -30,7 +30,7 @@ class ManageErrors extends HTMLController
 | 
			
		||||
				'action' => BASEURL . '/manageerrors/?' . Session::getSessionTokenKey() . '=' . Session::getSessionToken(),
 | 
			
		||||
				'method' => 'post',
 | 
			
		||||
				'class' => 'col-md-6 text-end',
 | 
			
		||||
				'buttons' => [
 | 
			
		||||
				'controls' => [
 | 
			
		||||
					'clear' => [
 | 
			
		||||
						'type' => 'submit',
 | 
			
		||||
						'caption' => 'Delete all',
 | 
			
		||||
 | 
			
		||||
@ -21,7 +21,7 @@ class ManageTags extends HTMLController
 | 
			
		||||
				'action' => BASEURL . '/edittag/',
 | 
			
		||||
				'method' => 'get',
 | 
			
		||||
				'class' => 'col-md-6 text-end',
 | 
			
		||||
				'buttons' => [
 | 
			
		||||
				'controls' => [
 | 
			
		||||
					'add' => [
 | 
			
		||||
						'type' => 'submit',
 | 
			
		||||
						'caption' => 'Add new tag',
 | 
			
		||||
 | 
			
		||||
@ -21,7 +21,7 @@ class ManageUsers extends HTMLController
 | 
			
		||||
				'action' => BASEURL . '/edituser/',
 | 
			
		||||
				'method' => 'get',
 | 
			
		||||
				'class' => 'col-md-6 text-end',
 | 
			
		||||
				'buttons' => [
 | 
			
		||||
				'controls' => [
 | 
			
		||||
					'add' => [
 | 
			
		||||
						'type' => 'submit',
 | 
			
		||||
						'caption' => 'Add new user',
 | 
			
		||||
 | 
			
		||||
@ -21,26 +21,19 @@ class InlineFormView
 | 
			
		||||
			echo '
 | 
			
		||||
				<div class="input-group">';
 | 
			
		||||
 | 
			
		||||
		if (!empty($form['fields']))
 | 
			
		||||
		foreach ($form['controls'] as $name => $control)
 | 
			
		||||
		{
 | 
			
		||||
			foreach ($form['fields'] as $name => $field)
 | 
			
		||||
			{
 | 
			
		||||
				if ($field['type'] === 'select')
 | 
			
		||||
					self::renderSelectBox($field, $name);
 | 
			
		||||
				else
 | 
			
		||||
					self::renderInputBox($field, $name);
 | 
			
		||||
			}
 | 
			
		||||
			if ($control['type'] === 'select')
 | 
			
		||||
				self::renderSelectBox($control, $name);
 | 
			
		||||
			elseif ($control['type'] === 'submit')
 | 
			
		||||
				self::renderSubmitButton($control, $name);
 | 
			
		||||
			else
 | 
			
		||||
				self::renderInputBox($control, $name);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		echo '
 | 
			
		||||
					<input type="hidden" name="', Session::getSessionTokenKey(), '" value="', Session::getSessionToken(), '">';
 | 
			
		||||
 | 
			
		||||
		if (!empty($form['buttons']))
 | 
			
		||||
			foreach ($form['buttons'] as $name => $button)
 | 
			
		||||
			{
 | 
			
		||||
				self::renderSubmitButton($button, $name);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		if (!empty($form['is_group']))
 | 
			
		||||
			echo '
 | 
			
		||||
				</div>';
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user