@@ -154,6 +154,9 @@ This component offers an easy way to create breadcrumbs for your application.
154
154
The resulting HTML when calling ` render() ` will have each breadcrumb enclosed
155
155
in ` <dt> ` tags, while the whole string is enclosed in ` <dl> ` tags.
156
156
157
+ @deprecated Will be removed in future version
158
+ Use {@see Phalcon\Html\Helper\Breadcrumbs} instead.
159
+
157
160
158
161
### Properties
159
162
``` php
@@ -957,6 +960,193 @@ Produce a `<body>` tag.
957
960
958
961
959
962
963
+ ## Html\Helper\Breadcrumbs
964
+
965
+ [ Source on GitHub] ( https://github.com/phalcon/cphalcon/blob/5.0.x/phalcon/Html/Helper/Breadcrumbs.zep )
966
+
967
+
968
+ - __ Namespace__
969
+
970
+ - ` Phalcon\Html\Helper `
971
+
972
+ - __ Uses__
973
+
974
+ - ` Phalcon\Html\Escaper\EscaperInterface `
975
+ - ` Phalcon\Support\Helper\Str\Interpolate `
976
+
977
+ - __ Extends__
978
+
979
+ ` AbstractHelper `
980
+
981
+ - __ Implements__
982
+
983
+
984
+ This component offers an easy way to create breadcrumbs for your application.
985
+ The resulting HTML when calling ` render() ` will have each breadcrumb enclosed
986
+ in ` <li> ` tags, while the whole string is enclosed in ` <nav> ` and ` <ol> ` tags.
987
+
988
+ @phpstan-type TTemplate = array{
989
+ main: string,
990
+ line: string,
991
+ last: string,
992
+ }
993
+ @phpstan-type TElement = array{
994
+ attributes: array<string, string>,
995
+ icon: string,
996
+ link: string,
997
+ text: string,
998
+ }
999
+
1000
+
1001
+ ### Properties
1002
+ ``` php
1003
+ /**
1004
+ * @var array<string , string >
1005
+ */
1006
+ private $attributes;
1007
+
1008
+ /**
1009
+ * Keeps all the breadcrumbs.
1010
+ *
1011
+ * @var array<int , TElement >
1012
+ */
1013
+ private $data;
1014
+
1015
+ /**
1016
+ * Crumb separator.
1017
+ *
1018
+ * @var string
1019
+ */
1020
+ private $separator = <li >/</li >;
1021
+
1022
+ /**
1023
+ * The HTML template to use to render the breadcrumbs.
1024
+ *
1025
+ * @var TTemplate
1026
+ */
1027
+ private $template;
1028
+
1029
+ /**
1030
+ * The HTML template to use to render the breadcrumbs.
1031
+ *
1032
+ * @var Interpolate
1033
+ */
1034
+ private $interpolator;
1035
+
1036
+ ```
1037
+
1038
+ ### Methods
1039
+
1040
+ ``` php
1041
+ public function __construct( EscaperInterface $escaper );
1042
+ ```
1043
+ AbstractHelper constructor.
1044
+
1045
+
1046
+ ``` php
1047
+ public function __invoke( string $indent = string, string $delimiter = null ): Breadcrumbs;
1048
+ ```
1049
+ Sets the indent and delimiter and returns the object back.
1050
+
1051
+
1052
+ ``` php
1053
+ public function add( string $text, string $link = string, string $icon = string, array $attributes = [] ): Breadcrumbs;
1054
+ ```
1055
+ Adds a new crumb.
1056
+
1057
+ ``` php
1058
+ // Adding a crumb with a link
1059
+ $breadcrumbs->add("Home", "/");
1060
+
1061
+ // Adding a crumb with added attributes
1062
+ $breadcrumbs->add("Home", "/", ["class" => "main"]);
1063
+
1064
+ // Adding a crumb without a link (normally the last one)
1065
+ $breadcrumbs->add("Users");
1066
+ ```
1067
+
1068
+
1069
+ ``` php
1070
+ public function clear(): void;
1071
+ ```
1072
+ Clears the crumbs.
1073
+
1074
+ ``` php
1075
+ $breadcrumbs->clear()
1076
+ ```
1077
+
1078
+
1079
+ ``` php
1080
+ public function clearAttributes(): Breadcrumbs;
1081
+ ```
1082
+ Clear the attributes of the parent element.
1083
+
1084
+
1085
+ ``` php
1086
+ public function getAttributes(): array;
1087
+ ```
1088
+ Get the attributes of the parent element.
1089
+
1090
+
1091
+ ``` php
1092
+ public function getSeparator(): string;
1093
+ ```
1094
+ Returns the separator.
1095
+
1096
+
1097
+ ``` php
1098
+ public function getTemplate(): array;
1099
+ ```
1100
+ Return the current template.
1101
+
1102
+
1103
+ ``` php
1104
+ public function remove( int $index ): void;
1105
+ ```
1106
+ Removes crumb by url.
1107
+
1108
+ ``` php
1109
+ // Remove the second element
1110
+ $breadcrumbs->remove(2);
1111
+ ```
1112
+
1113
+
1114
+ ``` php
1115
+ public function render(): string;
1116
+ ```
1117
+ Renders and outputs breadcrumbs based on previously set template.
1118
+
1119
+ ``` php
1120
+ echo $breadcrumbs->render();
1121
+ ```
1122
+
1123
+
1124
+ ``` php
1125
+ public function setAttributes( array $attributes ): Breadcrumbs;
1126
+ ```
1127
+ Set the attributes for the parent element.
1128
+
1129
+
1130
+ ``` php
1131
+ public function setSeparator( string $separator ): Breadcrumbs;
1132
+ ```
1133
+ Set the separator.
1134
+
1135
+
1136
+ ``` php
1137
+ public function setTemplate( string $main, string $line, string $last ): Breadcrumbs;
1138
+ ```
1139
+ Set the HTML template.
1140
+
1141
+
1142
+ ``` php
1143
+ public function toArray(): array;
1144
+ ```
1145
+ Returns the internal breadcrumbs array.
1146
+
1147
+
1148
+
1149
+
960
1150
## Html\Helper\Button
961
1151
962
1152
[ Source on GitHub] ( https://github.com/phalcon/cphalcon/blob/5.0.x/phalcon/Html/Helper/Button.zep )
@@ -3235,6 +3425,7 @@ Serializer method
3235
3425
3236
3426
- ` Phalcon\Factory\AbstractFactory `
3237
3427
- ` Phalcon\Html\Escaper\EscaperInterface `
3428
+ - ` Phalcon\Html\Helper\Breadcrumbs `
3238
3429
- ` Phalcon\Html\Helper\Doctype `
3239
3430
- ` Phalcon\Html\Helper\Input\Checkbox `
3240
3431
- ` Phalcon\Html\Helper\Input\Color `
@@ -3288,6 +3479,7 @@ The class implements `__call()` to allow calling helper objects as methods.
3288
3479
3289
3480
@method string a(string $href, string $text, array $attributes = [ ] , bool $raw = false)
3290
3481
@method string base(string $href, array $attributes = [ ] )
3482
+ @method Breadcrumbs breadcrumbs(string $indent = ' ', string $delimiter = "\n")
3291
3483
@method string body(array $attributes = [ ] )
3292
3484
@method string button(string $text, array $attributes = [ ] , bool $raw = false)
3293
3485
@method string close(string $tag, bool $raw = false)
0 commit comments