View Single Post
  #2  
Old 05-06-2018, 11:53 PM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: Dealing wiht Form in X-Cart 5

There is no built-in way to display the form in two columns, however you can split it into two "sections" and make it appear as two columns with CSS.

Here is an example from the PayPal module:
PHP Code:
namespace XLite\Module\CDev\Paypal\View\Model;

abstract class 
ASettings extends \XLite\View\Model\AModel
{
    
/**
     * Form sections
     */
    
const SECTION_ACCOUNT    'account';
    const 
SECTION_ADDITIONAL 'additional';

    protected 
$schemaAccount = array(
        
// ...
        
'user' => array(
            
self::SCHEMA_CLASS    => 'XLite\View\FormField\Input\Text',
            
self::SCHEMA_LABEL    => 'User',
            
self::SCHEMA_HELP     => 'PayPal recommends entering a User Login here instead of your Merchant Login',
            
self::SCHEMA_REQUIRED => true,
        ),
        
// ...
    
);

    protected 
$schemaAdditional = array(
        
// ...
        
'mode' => array(
            
self::SCHEMA_CLASS    => 'XLite\View\FormField\Select\TestLiveMode',
            
self::SCHEMA_LABEL    => 'Test/Live mode',
            
self::SCHEMA_REQUIRED => false,
        ),
        
// ...
    
);

    
// ...

    
public function __construct(array $params = array(), array $sections = array())
    {
        
$this->sections $this->getSettingsSections() + $this->sections;
        
parent::__construct($params$sections);
    }

    protected function 
getSettingsSections()
    {
        return array(
            static::
SECTION_ACCOUNT    => 'Your account settings',
            static::
SECTION_ADDITIONAL => 'Additional settings',
        );
    }

    
// ...


__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote