summaryrefslogtreecommitdiff
path: root/doc/es_ES/plugin-helpers.markdown
blob: 665910759861ed798d47ac321d8a4d60c3b01ade (plain)
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
Registrar nuevos helpers
=======================

Estrucura del helper:

```php
<?php

namespace Kanboard\Plugin\MyPlugin\Helper\MyHelper;

use Kanboard\Core\Base;

class MyHelper extends Base
{
    public function doSomething()
    {
        return 'foobar';
    }
}
```
Registrar tu helper en la clase:

```php
$this->helper->register('myHelper', '\Kanboard\Plugin\MyPlugin\Helper\MyHelper');
```

Usar tu helper desde una plantilla **Template**:

```php
<p>
    <?= $this->myHelper->doSomething() ?>
</p>
```

Usar tu helper dese otra clase:

```php
$this->helper->myHelper->doSomething();
```