Questions tagged [plugin-development]

Questions having to do with constructing plugins.

See Craft's Plugin Development Introduction for more.

1764 questions
8
votes
1 answer

Get all entries from a channel

Is there any known way to get all the entries from a certain channel? I dont want to do this in a view but in PHP since i need to do a bulk update of an attribute to all the entries in a certain channel.
mbalparda
  • 647
  • 6
  • 18
8
votes
2 answers

How to add a custom button at the right section of an entry?

I would like to add a custom button in the right section of a channels entry form in the CMS. The this button needs to go to a custom url of the plugin that I have created. The link should contain entry ID so that I can use this ID in my plugin.
Rbijker.com
  • 252
  • 2
  • 9
8
votes
1 answer

How do I add a block to a matrix that already has content via a plugin?

I'm building a plugin that adds blocks to a matrix in an entry from the front end. I got it up and running by following the answer in this post: How to save a matrix content of a new entry in my plugin? How do I check if the matrix already has…
Stephen Bowling
  • 712
  • 3
  • 12
7
votes
1 answer

Hello World Craft Plugin

I am a Joomla developer who has been asked to start developing Craft plugins and I'm afraid my brain is so moulded to the joomla way of doing things that I cannot even see how the template links to the plugin and fires events I'm especially…
7
votes
2 answers

How do I reference the settings of my plugin?

In the main Plugin.php file of my plugin, I can retrieve the plugin's settings like this: $this->getSettings() How do I retrieve those same settings from elsewhere in the plugin? I want to reference those setting from my Service.php file.
Lindsey D
  • 23,974
  • 5
  • 53
  • 110
7
votes
1 answer

Custom Log in Craft

Is there any way to create a custom log in Craft? I need to log some actions inside a controller/service in a custom plugin.
mbalparda
  • 647
  • 6
  • 18
7
votes
4 answers

Has anyone been able to get auto-complete working with plugins + PHPStorm?

It would make my day to be able to have PHPStorm recognize third-party services. Has anyone figured out how to get this working yet?
Tyler Willingham
  • 758
  • 4
  • 14
7
votes
2 answers

How do I fix getTemplatesPath() / setTemplatesPath() deprecation errors?

After updating to Craft 2.6.2778, my plugin is causing these deprecation errors: PathService::getTemplatesPath() has been deprecated. Use TemplatesService::getTemplatesPath() or TemplatesService::getTemplateMode()…
Brandon Kelly
  • 34,307
  • 2
  • 71
  • 137
6
votes
1 answer

Best practices for plugin service/controller/etc file names

When it comes to naming files within a plugin - is it preferable to follow PluginHandle_SomeController, or stuff everything inside a single PluginHandleController file? This is probably a subjective question for the most part - but in building out a…
Adam
  • 147
  • 4
6
votes
1 answer

ActiveRecord defineAttributes()

I have just started to build my first plugin with Craft CMS. Im at the part where I want to defne my database table. http://buildwithcraft.com/docs/plugins/database For the method definedAttributes() what values will the array accept. It looks like…
6
votes
1 answer

Where do I run validation before database insert?

I'm trying to wrap my head around when to use a Model and when to use a Record (or both?). I have both my Model and my Record. In my Controller I call my Service that creates my new Record instance before running the ->save(); command to save my new…
naboovalley
  • 2,844
  • 1
  • 16
  • 26
6
votes
1 answer

Where should a plugin create temporary files

I have a plugin which needs to create a temporary file. Where should I put it?
Marion Newlevant
  • 12,047
  • 22
  • 55
6
votes
1 answer

Craft ships with PHPUnit... How can we use it to test our plugins?

Since Craft ships with a copy of PHPUnit, is it possible to use that to run tests on a plugin? Or do we need to have a separate copy installed?
Lindsey D
  • 23,974
  • 5
  • 53
  • 110
6
votes
1 answer

Adding a RESTful, OAuth API on top of Craft

I’m currently considering options for a project that will require a standard sales site, commerce features and a user database. The user database will require a web frontend and an API for communication with a mobile app (read and write). My dilemma…
Dom Stubbs
  • 548
  • 4
  • 8
6
votes
1 answer

PHPUnit testing for Craft plugins or controllers

Is it possible to implement PHPUnit into Craft CMS? If so, where can I find a good explanation or tutorial? I already tried a Github link for a plugin (testing the plugin). But I am new to both but really want to TDD the plugins. Any example pages…
Bram B
  • 353
  • 1
  • 9
1
2 3
15 16