Hot answers tagged

2

Are you placing the SVG into your web page within an IMG tag, by any chance? If so, try changing to an inline SVG instead. There are quite a few SVG features that don’t work unless you use inline SVG, and from memory links are one of them.


2

Rather than assembling the email yourself, you can just call the sendActivationEmail method in Craft: if ($event->isNew) { Craft::$app->getUsers()->sendActivationEmail($user); } That will automatically generate the activation link for you.


2

The getPaymentFormHtml() method will output a huge chunk of code, including Stripe's iframe and all its nested fields and functionality - you can't simply wrap that in a label element and expect it to work, as the click event of the label will not reach inside the iFrame. The default output of Commerce Stripe's getPaymentFormHtml leaves a lot to be desired, ...


2

Since 3.4, you do this by passing an array of site ID/site-enabled mappings like so: $entry->enabledForSite = [1 => true, 2 => true]; Where 1 and 2 are your chosen site ids.


1

For info I managed installing the plugin using composer php functions, here's the code : use Composer\Factory; use Composer\IO\BufferIO; use Composer\Installer; use Composer\Json\JsonFile; use Composer\Package\Locker; use Craft; $io = new BufferIO; $jsonPath = realpath(__DIR__ . '/../../../composer.json'); $lockPath = realpath(__DIR__ . '/../../../composer....


1

Usually, site association for elements is controlled using the $siteId property. Try this: $superTableData['new1'] = [ 'type' => $blockType->id, 'enabled' => true, 'siteId' => 123, // replace with your site ID 'fields' => [ 'field1' => 'value', 'field2' => 'value', ] ];


1

The EVENT_REGISTER_CP_URL_RULES event only fires if you're loading a page in the Craft admin itself. If you're loading your site frontend it won't fire, you need to use EVENT_REGISTER_SITE_URL_RULES instead. You can see the logic around this here.


1

The error you're seeing is probably caused by this: ./.env.sh: line 128: $'\r': command not found This error indicates that your OS doesn't recognise the line endings in this file. This means the file isn't parsed correctly, which in turn means your environment variables are wrong (for example, the GLOBAL_DB_DRIVER might include a control character at the ...


1

Make sure you are importing the SproutForms base class into your php file. The code below assumes you'd be using the namespace of your actual custom module and class: <?php namespace modules/mycustommodule; use barrelstrength\sproutforms\SproutForms; class MyCustomClass { public function myCustomMethod() { $formHandle = 'my-form-handle'; $...


1

The error indicates that SproutForms::$app is not an object, which would mean it has not been initialized yet. If you look at the source code, you can see that SproutForms::$app is a static property on the SproutForms class that starts out undefined. It's only assigned the current App instance once it's init method has been executed. The static property ...


1

If you want full control on the activation email site/language/template you just can't rely on sendActivationEmail(). You can do this instead: use craft\mail\Message; // get activation link $verifyUrl = Craft::$app->users->getEmailVerifyUrl($user); // create email $msg = new Message(); $msg->setTo($user->email); $msg->setSubject('Activate ...


1

I would like to summarize the conclusion. In order to embed link on SVG image in Craft CMS website, inline SVG is the solution. It works with putting a source code into rich text field, like this; <figure style="width: 100%;"><object data="{{ image_url }}" type="image/svg+xml" width="100%"></object>&...


1

I like this solution: {# run queue #} {% do craft.app.queue.handleResponse %} {{ craft.app.response.content|raw }} Detailed in this post.


Only top voted, non community-wiki answers of a minimum length are eligible