Browse Source

Merge branch 'master' of github.com:VitexSoftware/ease-twbootstrap4

main
parent
commit
aaf516f80b
  1. 33
      src/Ease/TWB4/Form.php
  2. 22
      src/Ease/TWB4/Navbar.php

33
src/Ease/TWB4/Form.php

@ -1,12 +1,28 @@
<?php
/**
* Formulář Bootstrapu.
*/
namespace Ease\TWB4;
class Form extends \Ease\Html\Form
{
class Form extends \Ease\Html\Form {
public $formDiv = null;
/**
* Bootstrap Form
*
* @see https://getbootstrap.com/docs/4.1/components/forms/
*
* @param array $formProperties FormTag properties eg. ['enctype' => 'multipart/form-data']
* @param array $formDivProperties FormDiv propertise eg. ['class'=>'form-row align-items-center']
* @param mixed $formContents Any other initial content
*/
public function __construct($formProperties = [], $formDivProperties = [], $formContents = null) {
parent::__construct($formProperties);
$this->formDiv = parent::addItem(new \Ease\Html\DivTag($formContents, $formDivProperties));
}
/**
* Vloží prvek do formuláře.
@ -17,10 +33,9 @@ class Form extends \Ease\Html\Form
* @param string $helptext Dodatečná nápověda
*/
public function addInput($input, $caption = null, $placeholder = null,
$helptext = null)
{
$helptext = null) {
return $this->addItem(new FormGroup($caption, $input, $placeholder,
$helptext));
$helptext));
}
/**
@ -31,18 +46,18 @@ class Form extends \Ease\Html\Form
*
* @return pointer Odkaz na vložený objekt
*/
public function &addItem($pageItem, $pageItemName = null)
{
public function &addItem($pageItem, $pageItemName = null) {
if (is_object($pageItem) && method_exists($pageItem, 'setTagClass')) {
if (strtolower($pageItem->getTagType()) == 'select') {
$pageItem->setTagClass(trim(str_replace('form_control', '',
$pageItem->getTagClass().' form-control')));
$pageItem->getTagClass() . ' form-control')));
} elseif ($pageItem->getTagProperty('type') == 'file') {
$pageItem->setTagClass('form-control-file');
}
}
$added = parent::addItem($pageItem, $pageItemName);
$added = $this->formDiv->addItem($pageItem, $pageItemName);
return $added;
}
}

22
src/Ease/TWB4/Navbar.php

@ -39,6 +39,13 @@ class Navbar extends NavTag
*/
private $rightContent = null;
/**
* Brand link destination
* @var string
*/
public $mainpage = '#';
/**
* Menu aplikace.
*
@ -58,7 +65,7 @@ class Navbar extends NavTag
$properties['class'] = trim('navbar '.$originalClass);
$this->navBarName = $name;
parent::__construct([new ATag('#', $brand, ['class' => 'navbar-brand']),
parent::__construct([new ATag($this->mainpage, $brand, ['class' => 'navbar-brand']),
$this->navBarToggler()], $properties);
Part::twBootstrapize();
@ -66,9 +73,12 @@ class Navbar extends NavTag
}
/**
* Add new Menu Item into navbar
*
* @param type $content
* @param type $enabled
* @param mixed $content
* @param boolean $enabled
*
* @return LiTag MenuItem added
*/
public function addMenuItem($content, $enabled = true)
{
@ -93,7 +103,7 @@ class Navbar extends NavTag
break;
}
$this->leftContent->addItem(new LiTag($content,
return $this->leftContent->addItem(new LiTag($content,
['class' => implode(' ', $contentClass)]));
}
@ -102,10 +112,12 @@ class Navbar extends NavTag
*
* @param string $label submenu label
* @param array $items ['url'=>'label','url2'=>'label2','divider1'=>'',...]
*
* @return NavItemDropDown
*/
public function addDropDownMenu($label, $items)
{
$this->addMenuItem(new NavItemDropDown($label, $items));
return $this->addMenuItem(new NavItemDropDown($label, $items));
}
/**

Loading…
Cancel
Save