public function __construct($options, $form) { $columnsItems = array(); $items = isset($options['items']) ? $options['items'] : array(); // calculates the number of columns $this->columnsCount = 0; foreach ($options['items'] as $item) { $i = (!isset($item['column']) ? 1 : intval($item['column'])) - 1; $columnsItems[$i][] = $item; if ($i > $this->columnsCount) { $this->columnsCount = $i + 1; } } // calculates the number of rows $this->rowsCount = 0; foreach ($columnsItems as $items) { $count = count($items); if ($count > $this->rowsCount) { $this->rowsCount = $count; } } // creates elements parent::__construct($options, $form); // groups the created by columns $elementIndex = 0; $this->columns = array(); foreach ($columnsItems as $columnIndex => $columnItems) { $count = count($columnItems); for ($k = 0; $k < $count; $k++) { $this->columns[$columnIndex][] = $this->elements[$elementIndex]; $elementIndex++; } } }
/** * Creates a new instance of a form layout. * * @since 1.0.0 * @param mixed[] $options A holder options. * @param FactoryForms328_Form $form A parent form. */ public function __construct($options, $form) { $options['name'] = $this->name; $options['items'] = $form->getItems(); parent::__construct($options, $form); $this->addCssClass('factory-forms-328-' . $this->type); $this->addCssClass('factory-forms-328-' . $this->name); }
/** * Creates a new instance of control holder. * * @since 1.0.0 * @param mixed[] $options A holder options. * @param FactoryForms328_Form $form A parent form. */ public function __construct($options, $form) { parent::__construct($options, $form); $this->align = isset($options['align']) ? $options['align'] : 'horizontal'; }