tmcContactPlugin
1.0.0stable
for sf 1.4sf 1.3 and Doctrine
MIT
The tmcContactPlugin is a symfony plugin that simplifies the creation of a contact form.
It gives you the model (tmc_contact) and two modules
(tmcContact and tmcContactAdmin).
It allows a user to fill in a simple contact
form and submites to an e-mail, besides saving the information in a database.
Several options are available for the customization of appearance and behaviour using app.yml.
Developers
License
Copyright (c) 2010 Tito Miguel Costa
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Releases for sf 1.4
| Version |
License |
API |
Released |
|
1.0.0stable
|
MIT |
1.0.0stable
|
12/10/2010 |
Releases for sf 1.3
| Version |
License |
API |
Released |
|
1.0.0stable
|
MIT |
1.0.0stable
|
12/10/2010 |
Changelog for release 1.0.0 - 12/10/2010
Other releases
Release 1.0.0 - 12/10/2010
tmcContact plugin (for symfony 1.4) by Tito Miguel Costa symfony@titomiguelcosta.com
The tmcContactPlugin is a symfony plugin that provides a contact form.
It gives you the model (tmc_contact) and the modules
(tmcContact and tmcContactAdmin).
It allows a user to fill in a simple contact
form and submitting to an e-mail, saving the information in a database.
All in a configurable plugin.
Installation
Add the channel to your project
symfony plugin:add-channel pear.titomiguelcosta.com
Install the plugin (via a package)
symfony plugin:install pear.titomiguelcosta.com/tmcContactPlugin
Activate the plugin in the config/ProjectConfiguration.class.php
class ProjectConfiguration extends sfProjectConfiguration
{
public function setup()
{
$this->enablePlugins(array(
'sfDoctrinePlugin',
'tmcContactPlugin',
'...'
));
}
}
Rebuild your model
symfony doctrine:build-model
symfony doctrine:build-sql
Update you database tables by starting from scratch (it will delete all
the existing tables, then re-create them):
symfony doctrine:insert-sql
or do everything with one command
symfony doctrine:build --all`
Enable one or more modules in your settings.yml (optional)
For your backend application: tmcContactAdmin
all:
.settings:
enabled_modules: [default, tmcContactAdmin, ...]
For your frontend application: tmcContact
all:
.settings:
enabled_modules: [default, tmcContact, ...]
Clear you cache
symfony cc
Customize the behaviour of the plugin in app.yml
all:
tmcContactPlugin:
cc_to_sender: false # send a copy of the e-mail to the user
email_partial: tmcContact/email # partial that renders the e-mail
email_from: from@example.com
email_to: to@example.com
email_subject: contact form subject
redirect: tmc_contact # route to redirect after e-mail sent
show_errors_top: true
contact_form_id: contact_form # id of the form for javascript and css
subject_widget:
enabled: true
type: text #or choice
choices: {}
attachment_enabled: true
Customize sfGuardAuth module templates
By default, tmcContact module comes with 2 very simple partials:
If you want to customize one of these templates:
Create a tmcContact module in your application (don't use the
init-module task, just create a tmcContact directory)
Create a template with the name of the template you want to customize in
the tmcContact/templates directory
symfony now renders your partial instead of the default one
Customize tmcContact module actions
If you want to customize or add methods to the tmcContact:
Customize tmcContact redirect handling
If you want to redirect the user to a diferent page, you can specify the route
in the app.yml file.
You can change the redirect values in app.yml:
all:
tmcContactPlugin:
redirect: tmc_contact # the plugin uses the @tmc_contact by default
The flash user variable $object will be available with the contact object.
Customize tmcContact widgets
It is possible to enable/disable the subject and attachment widget in the app.yml
configuration file. For the subject widget, if enabled, it is even possible to
specify if the kind of widget, a text or a select box.
all:
tmcContactPlugin:
subject_widget:
enabled: true
type: choice #or text
choices: { 'support': 'Need help', 'other': 'Other topic' }
attachment_enabled: true