<?php
 namespace App\Form\Input; class CreditCardDetails extends \Engine\Form\Input\ElementWithElements { protected $class = "creditCardDetails"; public function __construct($label, $name, $value) { parent::__construct($label, $name, null); $this->setStyle('renderOrder', ['main', 'post']); $this->setStyle('renderMode', 'inline'); $ccNumberFld = \App\Form\Input\CreditCardNumber::create(null, $name.'[number]', $value['number']); $this->addElement( $ccNumberFld, 'main' ); $ccCompanyFld = \App\Form\Input\Select_CreditCardVendors::create(null, $name.'[company]', $value['company']); $ccCompanyFld->showDefaultOption(true); $this->addElement( $ccCompanyFld, 'post'); $_LANG = \App\Loader_Lang::getInstance()->getGlobal(); $possibleValues = []; for ( $y = TODAY_YEAR-1 ; $y<=TODAY_YEAR + 6 ; $y++ ) { $possibleValues[$y] = []; for ($m=1 ; $m<=12 ; $m++) { $possibleValues[$y][$y.'-'.sprintf('%02d', $m)] = $_LANG['date']['month']['short'][$m].' '.($y%100); } } $expireDateFld = \Engine\Form\Input\Select::create(null, $name.'[expireYm]', $value['expireYm']); $expireDateFld->showDefaultOption(); $expireDateFld->setPossibleValues($possibleValues); $this->addElement( $expireDateFld, 'post'); } } 