├── .env.dist ├── .gitignore ├── LICENSE ├── README.md ├── assets ├── .gitignore ├── js │ ├── App.jsx │ └── components │ │ ├── Option.jsx │ │ └── Type.jsx └── scss │ ├── app.scss │ ├── jekyll-theme-cayman.scss │ ├── normalize.scss │ ├── rouge-github.scss │ └── variables.scss ├── bin ├── console └── update.sh ├── composer-3.4.json ├── composer-4.3.json ├── composer-4.4.json ├── composer-5.0.json ├── composer-master.json ├── composer.json ├── composer.lock ├── config ├── bundles.php ├── packages │ ├── dev │ │ └── routing.yaml │ ├── doctrine.yaml │ ├── framework.yaml │ ├── prod │ │ └── doctrine.yaml │ ├── routing.yaml │ ├── test │ │ └── framework.yaml │ └── translation.yaml ├── routes.yaml ├── routes │ └── annotations.yaml └── services.yaml ├── docs ├── 3.4.35.json ├── 4.3.8.json ├── 4.4.0.json ├── build │ ├── css │ │ └── app.css │ ├── js │ │ └── app.js │ └── manifest.json ├── docs.json ├── index.html └── master.json ├── package.json ├── src ├── Command │ └── BuildCommand.php ├── Entity │ └── .gitignore └── Kernel.php ├── symfony.lock ├── tests └── .gitignore ├── translations └── .gitignore ├── webpack.config.js └── yarn.lock /.env.dist: -------------------------------------------------------------------------------- 1 | # This file is a "template" of which env vars need to be defined for your application 2 | # Copy this file to .env file for development, create environment variables when deploying to production 3 | # https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration 4 | 5 | ###> symfony/framework-bundle ### 6 | APP_ENV=dev 7 | APP_SECRET=fac90ea7a46ce7f8ba6b044165a4b43a 8 | #TRUSTED_PROXIES=127.0.0.1,127.0.0.2 9 | #TRUSTED_HOSTS=localhost,example.com 10 | ###< symfony/framework-bundle ### 11 | 12 | ###> doctrine/doctrine-bundle ### 13 | # Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url 14 | # For an SQLite database, use: "sqlite:///%kernel.project_dir%/var/data.db" 15 | # Configure your db driver and server_version in config/packages/doctrine.yaml 16 | DATABASE_URL=mysql://db_user:db_password@127.0.0.1:3306/db_name 17 | ###< doctrine/doctrine-bundle ### 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (http://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | 39 | # Typescript v1 declaration files 40 | typings/ 41 | 42 | # Optional npm cache directory 43 | .npm 44 | 45 | # Optional eslint cache 46 | .eslintcache 47 | 48 | # Optional REPL history 49 | .node_repl_history 50 | 51 | # Output of 'npm pack' 52 | *.tgz 53 | 54 | # Yarn Integrity file 55 | .yarn-integrity 56 | 57 | ###> symfony/framework-bundle ### 58 | .env 59 | /public/bundles/ 60 | /var/ 61 | /vendor/ 62 | ###< symfony/framework-bundle ### 63 | 64 | 65 | ###> symfony/webpack-encore-pack ### 66 | /node_modules/ 67 | /public/build/ 68 | ###< symfony/webpack-encore-pack ### 69 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Yonel Ceruto 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Symfony Forms Reference Generator 2 | 3 | TODO: 4 | - [X] Generate content per Symfony version (LTS, CURRENT, MASTER). 5 | - [X] Highlight deprecated options. 6 | - [ ] Show diff between versions. 7 | - [ ] Add option link to official docs. 8 | -------------------------------------------------------------------------------- /assets/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phplancer/symfony-form/a8146fe6c44c366b04af6a99b18d54bda7695179/assets/.gitignore -------------------------------------------------------------------------------- /assets/js/App.jsx: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import Type from './components/Type' 4 | 5 | class App extends Component { 6 | constructor(props) { 7 | super(props); 8 | this.state = { 9 | versions: [], 10 | version: null, 11 | error: null, 12 | is_loaded: false, 13 | symfony_version: null, 14 | updated_at: null, 15 | composer_info: null, 16 | types: [], 17 | type_extensions: [], 18 | type_guessers: [] 19 | }; 20 | 21 | this.handleClick = this.handleClick.bind(this); 22 | } 23 | 24 | componentDidMount() { 25 | fetch('docs.json') 26 | .then(data => data.json()) 27 | .then(docs => { 28 | const hash = window.location.hash; 29 | const version = hash.indexOf('/') > -1 ? hash.split('/')[0].substr(1) : docs.versions[0]; 30 | 31 | this.setState({ 32 | versions: docs.versions, 33 | version: version, 34 | }); 35 | this.fetchDocs(version); 36 | }); 37 | } 38 | 39 | handleClick(version) { 40 | if (version === this.state.version) { 41 | return; 42 | } 43 | 44 | this.setState({ 45 | version: version, 46 | }); 47 | 48 | this.fetchDocs(version, true); 49 | }; 50 | 51 | fetchDocs(version, clearHash = false) { 52 | fetch(version + '.json') 53 | .then(data => data.json()) 54 | .then((result) => { 55 | this.setState({ 56 | is_loaded: true, 57 | symfony_version: result.version, 58 | updated_at: result.updated_at, 59 | composer_info: result.composer_info, 60 | types: result.types, 61 | type_extensions: result.type_extensions, 62 | type_guessers: result.type_guessers 63 | }); 64 | 65 | // after update state, check by hash to scroll in 66 | const hash = window.location.hash; 67 | if (hash) { 68 | window.location.hash = ''; 69 | if (!clearHash) window.location.hash = hash; 70 | } 71 | }, 72 | // Note: it's important to handle errors here 73 | // instead of a catch() block so that we don't swallow 74 | // exceptions from actual bugs in components. 75 | (error) => { 76 | this.setState({ 77 | is_loaded: true, 78 | error 79 | }); 80 | }); 81 | } 82 | 83 | render() { 84 | const { 85 | error, is_loaded, 86 | versions, version, symfony_version, updated_at, composer_info, 87 | types, type_extensions, type_guessers 88 | } = this.state; 89 | 90 | if (error) { 91 | return
Error: {error.message}
; 92 | } 93 | if (!is_loaded) { 94 | return ''; 95 | } 96 | 97 | return ( 98 |
99 |
100 |

Form Types Reference

101 |

Symfony comes standard with a large group of field types that cover all of the common form fields and data types you'll encounter.

102 | 103 | View on GitHub 104 | Download .zip 105 | Download .tar.gz 106 |
107 | 108 |
109 |
110 | {versions.map((v) => ( 111 | this.handleClick(v)}>{v} 112 | ))} 113 |
114 | 115 |

Built-in Field Types

116 |
117 | {types.map(type => ( 118 | {type.name} 119 | ))} 120 |
121 | 122 |

Type Extensions

123 |
124 | {type_extensions.map(type => ( 125 | {type.name} 126 | ))} 127 |
128 | 129 |

Type Guessers

130 |
131 | {type_guessers.map(type => ( 132 | {type.name} 133 | ))} 134 |
135 |
136 | 137 |
138 |
139 |
Symfony version: {symfony_version} ( Composer Info )
{composer_info}
140 |
Last update: {updated_at}
141 |
142 |
143 | 144 |
145 | {types.map(type => ( 146 | 157 | ))} 158 | 159 | 163 |
164 |
165 | ); 166 | } 167 | } 168 | 169 | ReactDOM.render( 170 | , 171 | document.getElementById('root') 172 | ); 173 | -------------------------------------------------------------------------------- /assets/js/components/Option.jsx: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import PropTypes from "prop-types"; 3 | import Type from "./Type"; 4 | 5 | export default class Option extends Component { 6 | constructor(props) { 7 | super(props); 8 | this.state = { 9 | show_definition: props.show_definition 10 | }; 11 | 12 | this.handleClick = this.handleClick.bind(this); 13 | this.handleBlur = this.handleBlur.bind(this); 14 | } 15 | 16 | handleClick(event) { 17 | event.preventDefault(); 18 | this.setState(prevState => ({ 19 | show_definition: !prevState.show_definition 20 | })); 21 | }; 22 | 23 | handleBlur() { 24 | this.setState({show_definition: false}); 25 | }; 26 | 27 | render() { 28 | const {cls, name, required, default_value, deprecated, deprecation_message, is_lazy, allowed_types, allowed_values, has_normalizer, version} = this.props; 29 | const show_definition = this.state.show_definition; 30 | const id = version + '/' + Type.getClassName(cls) + '/' + name; 31 | const stringify = JSON.stringify(default_value, null, ' '); 32 | const final_deprecation_message = deprecation_message ? deprecation_message : 'Some values has been deprecated.'; 33 | 34 | return ( 35 |
39 | 40 | {name}{required ? '*' : ''} 41 | 50 |
51 | ) 52 | } 53 | } 54 | 55 | Option.propTypes = { 56 | cls: PropTypes.string.isRequired, 57 | name: PropTypes.string.isRequired, 58 | required: PropTypes.bool.isRequired, 59 | default_value: PropTypes.any, 60 | deprecated: PropTypes.bool, 61 | deprecation_message: PropTypes.string, 62 | is_lazy: PropTypes.bool, 63 | allowed_types: PropTypes.array, 64 | allowed_values: PropTypes.array, 65 | has_normalizer: PropTypes.bool, 66 | }; 67 | -------------------------------------------------------------------------------- /assets/js/components/Type.jsx: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import PropTypes from 'prop-types' 3 | import Option from './Option' 4 | 5 | export default class Type extends Component { 6 | constructor(props) { 7 | super(props); 8 | } 9 | 10 | static getClassName(cls) { 11 | return cls.split('\\').slice(-1)[0]; 12 | } 13 | 14 | renderOptions(options) { 15 | let i = 0; 16 | let result = []; 17 | for (let cls in options) { 18 | if (cls !== this.props.cls) { 19 | const className = Type.getClassName(cls); 20 | result.push( 21 |
22 | {className} 23 |
24 | ); 25 | } 26 | options[cls].map(option => { 27 | const id = '#' + this.props.version + '/' + Type.getClassName(this.props.cls) + '/' + option.name; 28 | result.push( 29 |