Skip to content

Instantly share code, notes, and snippets.

View johnwards's full-sized avatar

johnwards johnwards

  • Oxfordshire/Birmingham/London
View GitHub Profile
parameters:
wofb.webroot: %kernel.root_dir%/../web
wofb.uploaddir: /uploads
services:
fr.controllers.element:
class: FoodRisc\AccountAdminBundle\Controller\ContentTesterElementController
arguments:
- @service_container
- %wofb.webroot%%wofb.uploaddir%
<?php
class PlainType extends AbstractType
{
public function getDefaultOptions(array $options)
{
return array(
'read_only' => true,
);
<?php
namespace FoodRisc\AccountAdminBundle\Admin\Action;
use WhiteOctober\AdminBundle\Action\Action;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpFoundation\RedirectResponse;
class WaveSendInvitationsAction extends Action
{
<?php
namespace FoodRisc\AccountAdminBundle\Admin;
use Model\WhiteOctoberFormBuilderBundle\Form;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use FoodRisc\AccountAdminBundle\Admin\Action\WaveSendInvitationsAction;
class WaveAdmin extends Admin
<?php
namespace FoodRisc\MainBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;
class AccountRegisterType extends AbstractType
{
public function buildForm(FormBuilder $builder, array $options)
<?php
namespace Foo\AccountBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Validator\Constraints\Callback;
class CreatePasswordFormType extends AbstractType
{
{% block field_widget %}
{% spaceless %}
{% set type = type|default('text') %}
<input type="{{ type }}" {{ block('attributes') }} value="{{ value }}" class='field-{{ type }}'/>
{% endspaceless %}
{% endblock field_widget %}
{% block field_row %}
{% spaceless %}
<?php
$symfonyFormBuilder = $this->get('form.factory')
->createBuilder('form');
//An array of elements
$elements = array();
$symfonyFormBuilder->setAttribute('validation_constraint', new Callback(array("methods"=>array(
'validate' => function ($data, $context) use ($elements) {
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
<?php
use Symfony\Component\Validator\Mapping\ClassMetadata;
use Symfony\Component\Validator\Constraints\NotBlank;
class Stub
{
protected static $data = array();
public function setData($data)