FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
phpfui/src/PHPFUI/ButtonGroup.php at master · phpfui/phpfui · GitHub
phpfui
/
phpfui
Public
Notifications
You must be signed in to change notification settings
Fork
1
Star
7
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
phpfui
/
src
/
PHPFUI
/
ButtonGroup.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
89 lines (75 loc) · 1.63 KB
Breadcrumbs
phpfui
/
src
/
PHPFUI
/
ButtonGroup.php
Copy path
File metadata and controls
89 lines (75 loc) · 1.63 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?php
namespace
PHPFUI
;
/**
* Implements a ButtonGroup and Countable
*/
class
ButtonGroup
extends
\
PHPFUI
\HTML5Element
implements
\Countable
{
/** @var array<\PHPFUI\Button> */
protected
array
$
buttons
= [];
private
bool
$
started
=
false
;
public
function
__construct
()
{
parent
::
__construct
(
'
div
'
);
$
this
->
addClass
(
'
button-group
'
);
}
/**
* Add a button to the group with optional class
*
* @param Button $button to add
*/
public
function
addButton
(
\
PHPFUI
\
Button
$
button
) :
static
{
$
this
->
buttons
[] =
$
button
;
return
$
this
;
}
/**
* Add a class to all buttons in group
*/
public
function
addButtonClass
(
string
$
class
) :
static
{
foreach
(
$
this
->
buttons
as
&
$
button
)
{
$
button
->
addClass
(
$
class
);
}
return
$
this
;
}
/**
* Returns the number of buttons in the group
*/
public
function
count
() :
int
{
return
\count
(
$
this
->
buttons
);
}
/**
* Set a specific button in the bar to a new button, or add it
* if index is past the end of the group.
*
* @param int $index of the button to replace
* @param Button $button to replace
*/
public
function
setButton
(
int
$
index
,
\
PHPFUI
\
Button
$
button
) :
static
{
if
(
$
index
>=
0
&&
$
index
<
\count
(
$
this
->
buttons
))
{
$
this
->
buttons
[
$
index
] =
$
button
;
}
else
{
$
this
->
buttons
[] =
$
button
;
}
return
$
this
;
}
protected
function
getStart
() :
string
{
if
(!
$
this
->
started
)
{
$
this
->
started
=
true
;
foreach
(
$
this
->
buttons
as
$
button
)
{
$
this
->
add
(
$
button
);
}
}
return
parent
::
getStart
();
}
}
Back
|
FazBrowse Home
|
New Git URL