protected function addItemToTarget(array &$target, array $item, $first=false, $createGroup=false)
	{
		if(is_array($item['attributes'])) {
			$attributes = '';

			foreach($item['attributes'] as $attribute) {
				// do not assign empty attributes
				if($attribute['name'] == '') {
					continue;
				}

				if($attribute['name'] == 'class' && !isset($item['class'])) {
					$item['class'] = $attribute ['value'];
					continue;
				}

				$attributes .= $attributes ? ' ' : '';
				$attributes .= $attribute['name'] . '="' . $attribute ['value'] . '"';

			}

			$item['attributes'] = $attributes;
		}

		// make sure every key is set
		$item = array_merge(array(
				'type'      => '',
				'button'    => 'link',
				'attributes'=> '',
				'url'       => '',
				'label'     => ''
			), $item
		);


		if($first)
		{
			if($createGroup && isset($target[0]) && $target[0]['type'] == 'group')
			{
				$item = array('type' => 'group', 'items' => array($item));
			}

			$target = array_merge(array($item), $target);
			return;
		}

		if($createGroup)
		{
			$end = end($this->arrButtons);

			if($end !== false && $end['type'] == 'group')
			{
				$item = array('type' => 'group', 'items' => array($item));
			}
		}

		$target[] = $item;
	}
protected function addItemToTarget(array &$target, array $item, $first=false, $createGroup=false)
	{
		if(is_array($item['attributes'])) {
			$attributes = '';

			foreach($item['attributes'] as $attribute) {
				// do not assign empty attributes
				if($attribute['name'] == '') {
					continue;
				}

				if($attribute['name'] == 'class' && !isset($item['class'])) {
					$item['class'] = $attribute ['value'];
					continue;
				}

				$attributes .= $attributes ? ' ' : '';
				$attributes .= $attribute['name'] . '="' . $attribute ['value'] . '"';

			}

			$item['attributes'] = $attributes;
		}

		// make sure every key is set
		$item = array_merge(array(
				'type'      => '',
				'button'    => 'link',
				'attributes'=> '',
				'url'       => '',
				'label'     => ''
			), $item
		);


		if($first)
		{
			if($createGroup && isset($target[0]) && $target[0]['type'] == 'group')
			{
				$item = array('type' => 'group', 'items' => array($item));
			}

			$target = array_merge(array($item), $target);
			return;
		}

		if($createGroup)
		{
			$end = end($this->arrButtons);

			if($end !== false && $end['type'] == 'group')
			{
				$item = array('type' => 'group', 'items' => array($item));
			}
		}

		$target[] = $item;
	}
protected function addItemToTarget ( array & $ target , array $ item , $ first = false , $ createGroup = false ) { if ( is_array ( $ item [ 'attributes' ] ) ) { $ attributes = '' ; foreach ( $ item [ 'attributes' ] as $ attribute ) { // do not assign empty attributes if ( $ attribute [ 'name' ] == '' ) { continue ; } if ( $ attribute [ 'name' ] == 'class' && ! isset ( $ item [ 'class' ] ) ) { $ item [ 'class' ] = $ attribute [ 'value' ] ; continue ; } $ attributes .= $ attributes ? ' ' : '' ; $ attributes .= $ attribute [ 'name' ] . '="' . $ attribute [ 'value' ] . '"' ; } $ item [ 'attributes' ] = $ attributes ; } // make sure every key is set $ item = array_merge ( array ( 'type' => '' , 'button' => 'link' , 'attributes' => '' , 'url' => '' , 'label' => '' ) , $ item ) ; if ( $ first ) { if ( $ createGroup && isset ( $ target [ 0 ] ) && $ target [ 0 ] [ 'type' ] == 'group' ) { $ item = array ( 'type' => 'group' , 'items' => array ( $ item ) ) ; } $ target = array_merge ( array ( $ item ) , $ target ) ; return ; } if ( $ createGroup ) { $ end = end ( $ this -> arrButtons ) ; if ( $ end !== false && $ end [ 'type' ] == 'group' ) { $ item = array ( 'type' => 'group' , 'items' => array ( $ item ) ) ; } } $ target [ ] = $ item ; }
add item to a target, used for subitems and button component itself

@param array $target
@param array $item
@param bool  $first
@param bool  $createGroup
add item to a target used for subitems and button component itself