<p>Just my two cents, as <a href="https://craftcms.stackexchange.com/a/9825/45">Alec has already provided an excellent answer...</a></p>

<p>It seems like what you're looking for isn't necessarily a collection of plugins, but really a way to manage a <strong>base installation</strong>. You would then use this base installation as a starting point for your other projects, thus minimizing the amount of setup time you'd need for each new project.</p>

<p>We've done exactly that, and it works beautifully! We've got a Git repo setup with a clean Craft installation, plus the plugins which we use on virtually every project. Any common database changes have already been made, and an export of the database is included within the repo.</p>

<p>Using the base install is simple... Just download the project, install the database, and voila!</p>

<ul>
<li>Make sure the <code>.git</code> folder does not end up in your new project, since you'll probably be setting it up in a new repo.</li>
<li><strong>Make sure your <code>/config/license.key</code> file is omitted!</strong> The new project will create one automatically the first time it runs, and that license key file is crucial for identifying your site as a unique installation. Upgrades to your Craft edition (Client, Pro) are tied directly to that license file.</li>
</ul>

<p>This system has worked fantastically for us. It seems like this may be more along the lines of what you are looking for.</p>

CC BY-SA 3.0
2015-05-29T15:36:42.040Z
Hi Lindsey, you are right, your guess matches my original intention in some aspects, however, Iwas thinking about a simple business model around craft for a broader audience which I had to drop as it seems that would become too much heavy lifting to kick-off, which is maybe why nobody else has gone that path so far ;)
frank
CC BY-SA 3.0
2015-05-20T17:19:39.667Z
2015-05-20T17:19:39.667Z
2017-04-13T12:51:00.200Z
Lindsey D
<p>I'll try and cover as much as I can:</p>

<p><strong>Can you please point to some (working?) sample of implementing a barebone default / dev setup (css, js, basic templates, custom fields, groups, users, matrix forms, front-end forms,...) using a plugin?</strong></p>

<p>I don't think there would be anything where this is implemented with a plugin (unless i'm mistaken), but P&amp;T have an installation of Craft you can either clone on Github or generate from their website called HappyLager, this contains a bunch of boilerplate to you get you started including sections, entry types, matrix fields, relations, assets.</p>

<p>I don't think there is anything with users on there though due to licencing, Craft personal only allows one user and Client 1 Admin and 1 Client account : <a href="http://buildwithcraft.com/pricing" rel="nofollow noreferrer">http://buildwithcraft.com/pricing</a></p>

<ul>
<li>Generate a site for you to log in to: <a href="https://demo.buildwithcraft.com/" rel="nofollow noreferrer">https://demo.buildwithcraft.com/</a></li>
<li>Download the Repo and install it to your own server: <a href="https://github.com/pixelandtonic/HappyLager" rel="nofollow noreferrer">https://github.com/pixelandtonic/HappyLager</a></li>
</ul>

<p><strong>Is there a way to "enforce" presence (installation and activation) of "related" plugins ("must use" plugins) so I can develop a theme with functions/features related to other plugins I do not own?</strong></p>

<p>There is sort of a way to do this I believe, you would need to have a set of dependancies you could define as an array in your main plugin class, then when your plugin's CP/settings page is loaded, do the checks through a controller to see if the correct plugins are installed and proceed with notifications, errors when conditionals are met etc.</p>

<p>An example of a plugin i've seen that has done this is the Twitter plugin from Dukt, its free so you should be able to download it and find what you need. <code>TwitterPlugin.php</code> is where the logic is (from what I can see) then <code>controllers/TwitterController.php</code> to put it all together and then  <code>templates/settings/_dependancies.html</code> is how it's dealt with in the front end.</p>

<p><a href="https://dukt.net/craft/twitter" rel="nofollow noreferrer">https://dukt.net/craft/twitter</a></p>

<p>It might be worth having a read about plugin development: <a href="http://buildwithcraft.com/docs/plugins/introduction" rel="nofollow noreferrer">http://buildwithcraft.com/docs/plugins/introduction</a></p>

<p>But I think in your themes readme, a simple list of required plugins with links on how to get them would be good enough for most situations.</p>

<p><strong>In craft I don't get the point / simply don't understand where to start just to add custom fields and relations</strong></p>

<p>This should be solved or become apparent in the HappyLager demo? if not the documentation is quite helpful with this:</p>

<ul>
<li><a href="http://buildwithcraft.com/docs/sections-and-entries" rel="nofollow noreferrer">http://buildwithcraft.com/docs/sections-and-entries</a></li>
<li><a href="http://buildwithcraft.com/docs/fields" rel="nofollow noreferrer">http://buildwithcraft.com/docs/fields</a></li>
<li><a href="http://buildwithcraft.com/docs/relations" rel="nofollow noreferrer">http://buildwithcraft.com/docs/relations</a></li>
</ul>

<p><strong>I also don't see how I could use a plugin to create a theme / copy the related files and have them "managed" by my plugin.</strong></p>

<p>I think the problem with building a theme is there are so many factors involved with regards to how someone might have their backend set up (if retro fitting a theme) as you if you had something like <code>craft.entries.section('news')</code> in one of your templates but the section is called <code>blog</code> your theme isn't going to work.</p>

<p>For a clean install your problem might be with licensing, I'm not an expert on it by any means so if anyone else knows more information please edit this answer, but I would assume you would need to be careful how you add sections and users at the least.</p>

<p>Your plugin could generate sections on it's install, it could even generate users but I would probably check with Craft directly with this or read their <a href="http://buildwithcraft.com/license" rel="nofollow noreferrer">license</a> to be sure, but the methods to create such things are there in the internal API, you could take a look at the full class reference to see whats going on and whats available: <a href="http://buildwithcraft.com/classreference" rel="nofollow noreferrer">http://buildwithcraft.com/classreference</a></p>

<p>With regards to template files, you can change the location of these file, see <a href="https://craftcms.stackexchange.com/questions/4307/custom-template-location">Custom template location</a>, but I don't think you can get your plugin to do this, unless i'm mistaken.</p>

<p>As for theme files etc you could have a set directory structure when people install your theme and then use something like the <code>File</code> class to interact with these files <a href="http://buildwithcraft.com/classreference/etc/io/File" rel="nofollow noreferrer">http://buildwithcraft.com/classreference/etc/io/File</a></p>

<p>I hope that helps you get off to a start with building on Craft</p>

CC BY-SA 3.0
2015-05-20T16:52:39.887Z
Hi Alec, indeed, that helps a lot - thanks! I really do love the way craft looks and feels, as well as the features it offers out of the box that I / customers would have to pay for compared to WP - but WP leaves one huge advantage to me: I can create stuff with very little developer knowledge and can re-use that stuff easily across various projects - even on a single install. I am very confident, craft would be the right choice to move on, especially as it isn´t bloated, but I simply can't afford on filling my dev gaps just to reach the point where I am compared to WP. Craft is serious stuff!
frank
CC BY-SA 3.0
2015-05-20T17:21:16.083Z
Great answer, Alec. I'd add that the [Field Manager](https://github.com/engram-design/FieldManager) plugin could be used to handle import/export of fields.
Mats Mikkel Rummelhoff
CC BY-SA 3.0
2015-05-20T18:20:36.107Z
If I could vote this answer up twice, I would.
Brad Bell
CC BY-SA 3.0
2015-05-20T20:50:53.363Z
Cheers guys! Happy to have helped :) good shout on the field manager plugin too!
Alec Ritson
CC BY-SA 3.0
2015-05-20T12:20:28.143Z
2015-05-20T12:20:28.143Z
2017-04-13T12:51:00.303Z
Alec Ritson
<p>in <strong>short</strong>:
Can you please point to some (working?) sample of implementing a barebone default / dev setup (css, js, basic templates, custom fields, groups, users, matrix forms, front-end forms,...) using a plugin?</p>

<p>Also: Is there a way to "enforce" presence (installation and activation) of "related" plugins ("must use" plugins) so I can develop a theme with functions/features related to other plugins I do not own?</p>

<p><strong>Background:</strong>
I am starting over (again) with craft, simply as I am fed up managing plugins (i.e. with wordpress). One thing that I am really missing - which may be due to limited coding experience with craft - is a simple way to add my "defaults" (css, js, fields, forms, groups &amp; related (test)users,...) to the system to proceed creating templates (internal as well as customers). In wordpress I could simply extend the functions.php or use a custom site or template related plugin providing me the basics I want/need to proceed developing themes or plugins. In craft I don't get the point / simply don't understand where to start just to add custom fields and relations. I also don't see how I could use a plugin to create t theme / copy the related files and have them "managed" by my plugin.</p>

<plugin-development><templating>
How to use a plugin to add own fields, values, forms,...?
# How to use a plugin to add own fields, values, forms,...?

(Asked by: username_0 on 2015-05-20)

in **short**:
Can you please point to some (working?) sample of implementing a barebone default / dev setup (css, js, basic templates, custom fields, groups, users, matrix forms, front-end forms,...) using a plugin?

Also: Is there a way to "enforce" presence (installation and activation) of "related" plugins ("must use" plugins) so I can develop a theme with functions/features related to other plugins I do not own?

**Background:**
I am starting over (again) with craft, simply as I am fed up managing plugins (i.e. with wordpress). One thing that I am really missing - which may be due to limited coding experience with craft - is a simple way to add my "defaults" (css, js, fields, forms, groups & related (test)users,...) to the system to proceed creating templates (internal as well as customers). In wordpress I could simply extend the functions.php or use a custom site or template related plugin providing me the basics I want/need to proceed developing themes or plugins. In craft I don't get the point / simply don't understand where to start just to add custom fields and relations. I also don't see how I could use a plugin to create t theme / copy the related files and have them "managed" by my plugin.

**Tags:** plugin-development, templating

---

## 2 answers

### Answer by username_2 on 2015-05-20. Score: 5 | Accepted answer

I'll try and cover as much as I can:

**Can you please point to some (working?) sample of implementing a barebone default / dev setup (css, js, basic templates, custom fields, groups, users, matrix forms, front-end forms,...) using a plugin?**

I don't think there would be anything where this is implemented with a plugin (unless i'm mistaken), but P&T have an installation of Craft you can either clone on Github or generate from their website called HappyLager, this contains a bunch of boilerplate to you get you started including sections, entry types, matrix fields, relations, assets.

I don't think there is anything with users on there though due to licencing, Craft personal only allows one user and Client 1 Admin and 1 Client account : <http://buildwithcraft.com/pricing>

* Generate a site for you to log in to: <https://demo.buildwithcraft.com/>
* Download the Repo and install it to your own server: <https://github.com/pixelandtonic/HappyLager>

**Is there a way to "enforce" presence (installation and activation) of "related" plugins ("must use" plugins) so I can develop a theme with functions/features related to other plugins I do not own?**

There is sort of a way to do this I believe, you would need to have a set of dependancies you could define as an array in your main plugin class, then when your plugin's CP/settings page is loaded, do the checks through a controller to see if the correct plugins are installed and proceed with notifications, errors when conditionals are met etc.

An example of a plugin i've seen that has done this is the Twitter plugin from Dukt, its free so you should be able to download it and find what you need. `TwitterPlugin.php` is where the logic is (from what I can see) then `controllers/TwitterController.php` to put it all together and then `templates/settings/_dependancies.html` is how it's dealt with in the front end.

<https://dukt.net/craft/twitter>

It might be worth having a read about plugin development: <http://buildwithcraft.com/docs/plugins/introduction>

But I think in your themes readme, a simple list of required plugins with links on how to get them would be good enough for most situations.

**In craft I don't get the point / simply don't understand where to start just to add custom fields and relations**

This should be solved or become apparent in the HappyLager demo? if not the documentation is quite helpful with this:

* <http://buildwithcraft.com/docs/sections-and-entries>
* <http://buildwithcraft.com/docs/fields>
* <http://buildwithcraft.com/docs/relations>

**I also don't see how I could use a plugin to create a theme / copy the related files and have them "managed" by my plugin.**

I think the problem with building a theme is there are so many factors involved with regards to how someone might have their backend set up (if retro fitting a theme) as you if you had something like `craft.entries.section('news')` in one of your templates but the section is called `blog` your theme isn't going to work.

For a clean install your problem might be with licensing, I'm not an expert on it by any means so if anyone else knows more information please edit this answer, but I would assume you would need to be careful how you add sections and users at the least.

Your plugin could generate sections on it's install, it could even generate users but I would probably check with Craft directly with this or read their [license](http://buildwithcraft.com/license) to be sure, but the methods to create such things are there in the internal API, you could take a look at the full class reference to see whats going on and whats available: <http://buildwithcraft.com/classreference>

With regards to template files, you can change the location of these file, see [Custom template location](https://craftcms.stackexchange.com/questions/4307/custom-template-location), but I don't think you can get your plugin to do this, unless i'm mistaken.

As for theme files etc you could have a set directory structure when people install your theme and then use something like the `File` class to interact with these files <http://buildwithcraft.com/classreference/etc/io/File>

I hope that helps you get off to a start with building on Craft

> **Comments:**
> **username_0**: Hi Alec, indeed, that helps a lot - thanks! I really do love the way craft looks and feels, as well as the features it offers out of the box that I / customers would have to pay for compared to WP - but WP leaves one huge advantage to me: I can create stuff with very little developer knowledge and can re-use that stuff easily across various projects - even on a single install. I am very confident, craft would be the right choice to move on, especially as it isn´t bloated, but I simply can't afford on filling my dev gaps just to reach the point where I am compared to WP. Craft is serious stuff!  
> **username_3**: Great answer, Alec. I'd add that the [Field Manager](https://github.com/engram-design/FieldManager) plugin could be used to handle import/export of fields.  
> **username_4**: If I could vote this answer up twice, I would.  
> **username_2**: Cheers guys! Happy to have helped :) good shout on the field manager plugin too!  

---

### Answer by username_1 on 2015-05-20. Score: 5

Just my two cents, as [Alec has already provided an excellent answer...](https://craftcms.stackexchange.com/a/9825/45)

It seems like what you're looking for isn't necessarily a collection of plugins, but really a way to manage a **base installation**. You would then use this base installation as a starting point for your other projects, thus minimizing the amount of setup time you'd need for each new project.

We've done exactly that, and it works beautifully! We've got a Git repo setup with a clean Craft installation, plus the plugins which we use on virtually every project. Any common database changes have already been made, and an export of the database is included within the repo.

Using the base install is simple... Just download the project, install the database, and voila!

* Make sure the `.git` folder does not end up in your new project, since you'll probably be setting it up in a new repo.
* **Make sure your `/config/license.key` file is omitted!** The new project will create one automatically the first time it runs, and that license key file is crucial for identifying your site as a unique installation. Upgrades to your Craft edition (Client, Pro) are tied directly to that license file.

This system has worked fantastically for us. It seems like this may be more along the lines of what you are looking for.

> **Comments:**
> **username_0**: Hi Lindsey, you are right, your guess matches my original intention in some aspects, however, Iwas thinking about a simple business model around craft for a broader audience which I had to drop as it seems that would become too much heavy lifting to kick-off, which is maybe why nobody else has gone that path so far ;)  

---

