Completed
Push — master ( b77ba2...042f42 )
by Jean-Christophe
03:22
created

HtmlNavElement::jsSetContent()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
namespace Ajax\bootstrap\html\base;
3
4
use Ajax\common\html\traits\NavElementTrait;
5
6
/**
7
 * Bs class for navigation elements : Breadcrumbs and Pagination
8
 * @author jc
9
 * @version 1.001
10
 */
11
abstract class HtmlNavElement extends HtmlBsDoubleElement {
12
	use NavElementTrait;
13
	/**
14
	 * @var string the root site
15
	 */
16
	protected $root;
17
18
	/**
19
	 * @var String the html attribute which contains the elements url. default : data-ajax
20
	 */
21
	protected $attr;
22
23
24
	public function __construct($identifier,$tagName){
25
		parent::__construct($identifier,$tagName);
26
		$this->root="";
27
		$this->attr="data-ajax";
28
	}
29
30
	/**
31
	 * Associate an ajax get to the elements, displayed in $targetSelector
32
	 * $this->attr member is used to build each element url
33
	 * @param string $targetSelector the target of the get
34
	 * @return HtmlNavElement
35
	 */
36
	public function autoGetOnClick($targetSelector){
37
		return $this->getOnClick($this->root, $targetSelector,array("attr"=>$this->attr));
38
	}
39
40
	public function contentAsString(){
41
		return implode("", $this->content);
42
	}
43
}