You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ensure a field value starts with a specific prefix. Returns the field for chaining.
197
225
```php
198
-
$page->myField()->ensureLeft('https://');
226
+
$page->url()->ensureLeft('https://')->value();
199
227
```
200
228
201
229
### `ensureRight(string $suffix): string`
230
+
Ensure a field value ends with a specific suffix. Returns the field for chaining.
231
+
```php
232
+
$page->path()->ensureRight('/')->value();
233
+
```
234
+
235
+
### `ensureHashed(): string`
236
+
Ensure a field value starts with a hash character (#). Useful for anchor links. Returns the field for chaining.
237
+
```php
238
+
$page->anchor()->ensureHashed()->value();
239
+
// 'section-1' becomes '#section-1'
240
+
```
241
+
242
+
### `autoLinkTitles(): string`
243
+
Automatically add accessible title attributes to all links in HTML content. Detects internal pages, files, email, phone, and external links. Returns the field for chaining.
202
244
```php
203
-
$page->myField()->ensureRight('/');
245
+
$page->text()->kirbytext()->autoLinkTitles();
246
+
// Adds appropriate title attributes to all <a> tags
0 commit comments