Questions tagged [function]
The function tag has no usage guidance.
9
questions
2
votes
3
answers
169
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
1
answer
32
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
2
answers
202
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
1
answer
711
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
1
answer
80
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
1
answer
742
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
2
answers
379
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
1
answer
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
2
answers
215
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?