Skip to main content

Questions tagged [function]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2 votes
4 answers

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 ...
Matthias Redl-Mann's user avatar
3 votes
1 answer

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' %} {% ...
Jonathan Schofield's user avatar
1 vote
2 answers

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,$...
Cole Henley's user avatar
  • 1,741
2 votes
1 answer

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 ( ). I am trying to calculate the loan ...
Angela's user avatar
  • 569
0 votes
1 answer

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 ...
neoDev's user avatar
  • 285
2 votes
1 answer

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....
Lettie's user avatar
  • 2,033
2 votes
2 answers

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 ...
taylor's user avatar
  • 1,128
2 votes
1 answer

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 ...
Mark Notton's user avatar
  • 2,337
8 votes
2 answers

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?
Niall Thompson's user avatar