Hot answers tagged

17 votes
Accepted

How can I check if a plugin is installed and enabled?

On top of checking within the admin area, there are some other ways you can do this, both in templates and in your plugins. In a template {# Second argument is if you want enabled only #} {% set ...
Alec Ritson's user avatar
  • 4,519
17 votes

Invalid plugin: No plugin exists with the handle - Craft 3

For future reference, I had the same error and resolved it with Craft Support. In my case the project.yaml file got out of sync with what was in the database. Running craft project-config/rebuild ...
mjr's user avatar
  • 1,405
13 votes

Protect a page with a single password?

The easiest way I have found to password protect page content is as follows: {% if craft.request.getParam('password') == 'password_you_want' %} <h2>This is your content</h2> {% else %}...
Allan Kukral's user avatar
12 votes
Accepted

How can I print the name of every template being rendered in HTML comments, when in devMode?

So this sounded like a fun problem to solve... so I wrote the Template Comments plugin that does what you want: This free plugin adds a HTML comment to demarcate {% block %}s and each Twig template ...
andrew.welch's user avatar
  • 11.3k
11 votes
Accepted

Tasks and Steps

You can implement your entire Task with a single step if you want. The only point of breaking it into multiple steps is so the task progress bar has an idea of how far along the task is. In your case,...
Brandon Kelly's user avatar
10 votes
Accepted

Plugin settings - file field upload location

Unfortunately, a simple HTML file input on its own isn't enough to upload an image (in Craft or anywhere else) – the input simply exposes the file on your local filesystem to the browser/server. In ...
Mats Mikkel Rummelhoff's user avatar
10 votes
Accepted

how to uninstall a plugin when there is no cp option

It isn't possible to uninstall a disabled plugin; you'll need to first enable the plugin, and then the Uninstall option will be available. The correct way to remove a plugin is actually to first ...
Mats Mikkel Rummelhoff's user avatar
9 votes

How do I add custom styles/plugins to the rich text editor in Craft?

It's worth noting that as of Craft 2.5, it's now using Redactor II, so the above code examples don't work if you have upgraded. Here's a working JSON config example you can build on: { "buttons": ...
neekster's user avatar
  • 403
8 votes
Accepted

Cannot declare class because the name is already in use

At this point, after much playing around it seems to be working (at least on to the next bit of debugging). To sum up, it was mostly changes to composer.json, followed by composer remove kr37/...
kr37's user avatar
  • 1,293
7 votes
Accepted

Are there any plugins for Craft 3?

Update: Since Craft 3 was officially released (4/4/18), all plugins can be found in the Craft Plugin Store! Original: Now that the Craft 3 Beta is out and we’re done making breaking changes to ...
7 votes
Accepted

Twig url() function returns CP path when called from plugin

Right, url() (and UrlHelper::getUrl(), which url() maps to) will create a URL to either a front-end page or a CP page, depending on where it is being called from. If you want to get a front-end URL ...
Brandon Kelly's user avatar
7 votes
Accepted

Manual Plugin installation on Craft 3

You have to create the folder where you want to include your plugins by yourself. There are no requirements how you name it. Let's say you want to create the folder plugins in your Craft folder, then ...
Robin Schambach's user avatar
6 votes

How can I check if a plugin is installed and enabled?

For craft cms 3 {% set plugin = craft.app.plugins.getPlugin('plugin-handle', false) %} {% if plugin is not null and plugin.isInstalled %} .... call plugin related stuff here ..... {% endif %} ...
inrsaurabh's user avatar
6 votes

Issue with rendering a template from a plugin function

I haven't tried calling a template from a controller, so I may not be any help but I've used ...->render(...) in my main plugin Class like this: MyPlugin.php return craft()->templates->...
Damon's user avatar
  • 4,706
6 votes
Accepted

Export Craft Data

One way to handle this is by using the Export and Import tools by Bob Olde Hampsink. This will allow you to output the data to a CSV file, which you can hand off to the translator. Be wary though, if ...
Lindsey D's user avatar
  • 23.9k
6 votes
Accepted

Is Craft suitable for these specific document management goals?

If Craft is good enough for the AP, it'll be good enough for everyone. ;) I have little experience with EE, other than migrating away from it, but I have built enough in WordPress so here's my ...
RitterKnight's user avatar
  • 6,572
6 votes

How to build a transactional email platform with Craft

This answer will focus on using Sprout Email for transactional emails. Transactional Emails First, a comment on semantics. I feel the question above is drawing a distinction between two types of ...
Ben Parizek's user avatar
  • 13.4k
6 votes
Accepted

Does anyone use Craft CMS to set up an intranet for client?

There currently isn't a single plugin that does everything that BuddyPress does. There are calender plugins, commenting plugins, social login and oauth plugins and Craft Pro has built-in front-end ...
Brad Bell's user avatar
  • 67.2k
6 votes
Accepted

Store Hours (group days by hours)

I think I have a solution to this problem, but it's kind of complicated. There may be a way to simplify this more. The basic idea is to loop thru your Store Hours field (entry.hoursOfOperation) and ...
Alex Roper's user avatar
  • 2,622
6 votes

Plugins not showing in Admin

Probably the name of the folder isn't the plugin handle. Check inside the plugin's folder to see if the actual plugin folder is inside there. For instance: forge@nys-production ~/nystudio107.com/...
andrew.welch's user avatar
  • 11.3k
6 votes
Accepted

How can I check if a plugin is installed and enabled, in Craft 3?

PHP \Craft::$app->plugins->isPluginInstalled('plugin-handle') Twig {% set installed = craft.app.plugins.isPluginInstalled('plugin-handle') %} There is also a isPluginDisabled and a ...
Robin Schambach's user avatar
6 votes
Accepted

Unable to delete plugin

Although I'm not in favor of the nuclear option in international politics, it works very fine and simply this case. Brad's suggestion of deleting the craft/vendor folder and composer.lock and then ...
kr37's user avatar
  • 1,293
6 votes

Looking for an advanced form plugin for Craft CMS

To answer your questions in regards to how they will fit with Freeform... If what you mean by pre-populating fields with existing data is being able to fill fields with data from other elements, ...
Solspace's user avatar
  • 1,390
5 votes

Plugins: Is there any events and/or calendar plugin in the making?

We recently launched Venti 2 – a powerful event calendar management plugin built exclusively for Craft CMS! Check it out at https://venticalendar.io
Brian's user avatar
  • 51
5 votes

Plugins: Is there any events and/or calendar plugin in the making?

I'm happy to report that Craft Calendars is officially released. The Calendars plugin enables you to set up multiple calendars, repeating/recurring events, multi-language content, monthly calendar ...
Michael Rog's user avatar
  • 3,400
5 votes
Accepted

Show Facebook Page Feed on Website

First, you would need to create an app for your Facebook page. You are also going to need a Facebook developer account: developers.facebook.com. Once your app is created and you have a Facebook ...
Kelly Cook's user avatar
5 votes

Upload any size image into carousel

You shouldn't need to create a custom plugin to do that. You can easily create a Matrix content field for your carousel. Create a new block called slide. From there you can create an asset field to ...
Rob Erskine's user avatar
5 votes
Accepted

How can I use another plugin in PHP?

Your approach is technically correct – the problem is that craft()->imager->transformImage() requires two additional parameters; $transformDefaults and $configOverrides. You can read more about ...
Mats Mikkel Rummelhoff's user avatar
5 votes

Cannot enable Craft plugin in control panel

My guess is it's a case sensitivity issue with the main plugin class/file name (some operating systems have case sensitive filesystems and some don't). You can review the requirements for how things ...
Brad Bell's user avatar
  • 67.2k
5 votes

Move unused Assets to a specific Folder

I found the solution: The moveFiles function provide the function to move a file: /** * Move or rename files. * * @param $fileIds * @param $folderId * @param string $filename If this is ...
Tom Bauer's user avatar
  • 1,327

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