services. Allow you to create, update& delete database tables, Allows you to input / output data from your front end templates e.g. {{ var }} Allows your plugin to be configurable by the user. Where all your functions and bulk of your plugin will go. Containers for the data so it can be passed between services etc. Settings Models Records Services Variables
database tables. Controllers Models Records Services Variables Points Allows admins to create & delete point events (e.g. Signed Up to Newsletter) and entries (e.g. Scott Signed Up to Newsletter) via a form in the Craft CMS Sets the data layout. E.g. 'Events’ have Event, Event Handle & Points. To be either stored via a record or manipulated via a service. All the logic for creating the events and entries is done inside functions in the services. Interacted by a Controller or Variable. e.g. {{ craft.points.addEntry({ eventHandle: 'SignedUpToNewsletter' }) }}
functions start with the plugin name, then what the le type is... PluginName_WhatItDoesModel.php PluginName_WhatItDoesRecord.php PluginName_WhatItDoesController.php
in to your pluginname.log le in /craft/storage/logs/ * Reduces the hair loss when debugging ‘Array to string conversion’ issues PluginNamePlugin::log(’Mmm Donuts’);
can extend a form eld such as a elementSelect eld by knowing it’s name and attributes. {% import "_includes/forms" as forms %} {{ forms.textField({ label: 'New Code Group', name: 'codeGroup', }) }} /craft/app/templates/_includes/forms/
records you need to state what ‘type’ it is, e.g. a Integer, Date etc. Knowing how to format these helps! 'eventDate' => array(AttributeType::DateTime)