Questions tagged [function]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2
votes
3answers
46 views

TWIG dataUrl function for resized images

Craft provides the very nice TWIG function dataUrl(pathToImg) to inline images in e-mails. E.g. <img src="{{ dataUrl('@webroot/assets/img/logo.svg')" /> will base64 encode the image ...
3
votes
1answer
30 views

Setting valueless boolean attributes with the tag function

When using the tag function, how does one handle valueless attributes which could also be null? For example, it's great we can do… {% set idVar = 'idstring' %} {% set nameVar = 'namestring' %} {% ...
1
vote
2answers
186 views

Recursive array search

I've got a plugin where I've written a simple recursive array search to find an array within a nested/multidimensional array which contains a certain value. private function arraySearch($haystack,$...
2
votes
1answer
690 views

Is there a logarithm function in Craft or Twig?

I searched the Craft and Twig documentation, although I did not find any information about a logarithm function (http://php.net/manual/en/function.log.php ). I am trying to calculate the loan ...
0
votes
1answer
76 views

How can I access variables only declared in a template?

I have a template inside a folder located in /templates that is not related to any entry or section: /folder/test.html {% extends '_layout' %} {% set title = 'myTitle' %} {% set ...
2
votes
1answer
660 views

Deprecated Warning

Just received this deprecated warning in the dashboard. However the file it refers to does not contain the deprecated code. Any ideas? I can locate the deprecated function in several core files though....
2
votes
2answers
354 views

Multiple Service/Variable/Controller plugin files

I'm not sure if I missed documentation on it, but is there a method to follow when including additional plugin files for services, controllers, variables etc.? For bigger plugins it'd help to do ...
2
votes
1answer
1k views

Call a public function within a FieldType file, from a variables files

I have a plugin called "myPlugin", this has a variables file. Within there, I have a something like this: public function helloWorld() { return "Hello World"; } Also within this plugin, I've created ...
8
votes
2answers
214 views

Is there a native function or plugin to allow admins to email all users?

I want to be able to provide the admin with a function so that they can email all registered users of the site. Is there a native function or plugin that would make this possible?