| 4 | | sfWidgetFormTreePlugin creates - similar to sfWidgetFormChoice/ChoiceMultiple - |
|---|
| 5 | | a tree structure widget consisting of radio buttons or checkboxes. So you can |
|---|
| 6 | | maintain hierarchical data whithin your symfony forms. |
|---|
| 7 | | |
|---|
| 8 | | It has the same functionality as the wordpress "assign blog article to |
|---|
| 9 | | categories x, y and z", to enlighten what this plugin may do for you. |
|---|
| 10 | | |
|---|
| 11 | | The plugin widgets have a few validators that also can check simple constraints |
|---|
| 12 | | (e.g. "self drops/movements" of nodes). |
|---|
| 13 | | |
|---|
| 14 | | There is a screenshot to experience the look and feel of the widget. |
|---|
| 15 | | No javascript required or included. |
|---|
| | 4 | sfWidgetFormInputSWFUploadPlugin decorates a file input widget with queued |
|---|
| | 5 | uploading capabilities, provided by SWFUpload (www.swfupload.org). |
|---|
| 20 | | sfWidgetFormTree provides a widget to render a structured group of checkboxes |
|---|
| 21 | | or radiobuttons that represent nodes in a tree. |
|---|
| 22 | | |
|---|
| 23 | | They are configured like all select/multiselect-widgets by giving a mandatory |
|---|
| 24 | | array of choices. |
|---|
| 25 | | |
|---|
| 26 | | Due the fact that a hierarchy is displayed, this array must have information |
|---|
| 27 | | about that. |
|---|
| 28 | | |
|---|
| 29 | | It is possible to pass 2 types of arrays: |
|---|
| 30 | | |
|---|
| 31 | | Multi-Dim (with childnodes): |
|---|
| 32 | | ---------------------------- |
|---|
| 33 | | |
|---|
| 34 | | $choices = array( |
|---|
| 35 | | 1=> array('label'=>'test', 'children'=>array( |
|---|
| 36 | | 2=> array('label'=>'test2', 'children'=> array( |
|---|
| 37 | | 3=> array('label'=>'test3'), |
|---|
| 38 | | 4=> array('label'=>'hans') |
|---|
| 39 | | )), |
|---|
| 40 | | 5=> array('label'=>'wurst') |
|---|
| 41 | | )), |
|---|
| 42 | | 6=>array('label'=>'letzter') |
|---|
| 43 | | ); |
|---|
| 44 | | |
|---|
| 45 | | Single-DIM (with level/depth): |
|---|
| 46 | | ------------------------------ |
|---|
| 47 | | |
|---|
| 48 | | $choices = array( |
|---|
| 49 | | 1=>array('level'=>0, 'label'=>"+++1"), |
|---|
| 50 | | 2=>array('level'=>0, 'label'=>"+++2"), |
|---|
| 51 | | 3=>array('level'=>1, 'label'=>"+++3"), |
|---|
| 52 | | 4=>array('level'=>2, 'label'=>"+++4"), |
|---|
| 53 | | 8=>array('level'=>3, 'label'=>"+++8"), |
|---|
| 54 | | 9=>array('level'=>3, 'label'=>"+++9"), |
|---|
| 55 | | 10=>array('level'=>3, 'label'=>"+++10"), |
|---|
| 56 | | 11=>array('level'=>4, 'label'=>"+++11"), |
|---|
| 57 | | 12=>array('level'=>4, 'label'=>"+++12"), |
|---|
| 58 | | 13=>array('level'=>3, 'label'=>"+++13"), |
|---|
| 59 | | 5=>array('level'=>2, 'label'=>"+++5"), |
|---|
| 60 | | 6=>array('level'=>1, 'label'=>"+++6"), |
|---|
| 61 | | 7=>array('level'=>0, 'label'=>"+++7"), |
|---|
| 62 | | ); |
|---|
| 63 | | |
|---|
| 64 | | There is also a tree validator which allows to check against a given id (or |
|---|
| 65 | | a collection of ids), so that it is not allowed to select a node within the tree |
|---|
| 66 | | that is child of a given parent: |
|---|
| 67 | | |
|---|
| 68 | | $this->validatorSchema['category_ids'] = new sfValidatorTreeMany(array( |
|---|
| 69 | | 'choices'=>$choices, |
|---|
| 70 | | 'restrict_select_below'=>array(10,6), |
|---|
| 71 | | 'required'=>false |
|---|
| 72 | | )); |
|---|
| 73 | | |
|---|
| 74 | | This could be useful if you deal e.g. with a taxonomy system and want to move |
|---|
| 75 | | nodes with your admin form. In this case it is not allowed to move a category |
|---|
| 76 | | as a child of it's own. With the option |
|---|
| 77 | | |
|---|
| 78 | | 'restrict_select_below'=>array(parent_node_1, ..., parent_node-n); |
|---|
| 79 | | |
|---|
| 80 | | you can define the nodes that are not allowed to select (including its child |
|---|
| 81 | | nodes). |
|---|
| | 10 | Use the widget like an ordinary file upload widget and configure it by |
|---|
| | 11 | passing custom options to its options array. |
|---|