sfFlashWidgetPlugin - 1.0.1

Widget for Flash

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to the Plugins Home

Signin


Forgot your password?
Create an account

Tools

Stats

advanced search
Information Readme Releases Changelog Contribute
Show source

sfFlashWidgetPlugin

Overview

The sfFlashWidgetPlugin is a symfony plugin inspired in the sfWidgetFormInputFileEditable widget of Fabien Potencier (a symfony included class). It install a new widget that represents an upload HTML input tag (template -able) for flash objects

Installation

  • Download and install the plugin

    ./symfony plugin:install sfFlashWidgetPlugin
    
  • Clear the cache

    ./symfony cc
    

Configuration

  • Enable the plugin sfFlashWidgetPlugin on a project, via /config/ProjectConfiguration.class.php:

      class ProjectConfiguration extends sfProjectConfiguration
      {
        public function setup()
        {
          $this->enablePlugins( 'sfFlashWidgetPlugin');
        }
      }
    

How to use it

in your form class

$this->setWidget('flash', new sfWidgetFormInputFlashFile(array(
    'label' => 'Flash',
    'file_src' => '/uploads/' . $this->getobject()->getFlash(),
    'movie' => $this->getobject()->getFlash(),
    'flash_width' => 200,
    'flash_height' => 180,
    'is_flash' => true,
    'edit_mode' => $this->getobject()->getFlash(),
    'template' => '<div>%file%<br />%input%</div>',
    )));
$this->setValidator('flash', new sfValidatorFile(
        array(
            'required' => !$this->getobject()->flash,
            'path' => 'uploads' ,
            'max_size' => 100000,
        ), 
       array(
        'max_size' => 'wrong file size!  (max %max_size% bytes).',
        )
));