Commit Graph

55 Commits

Author SHA1 Message Date
Loz Calver 7f8f5afc91 Ensure forms/fields overridden by onBeforeRender() can override templates 2022-11-02 11:57:57 +00:00
Loz Calver e2cb683f14 FIX: Stop FormField onBeforeRenderHolder extension result being overridden 2022-11-02 10:06:23 +00:00
Viktor Szépe 94d1ac8d99
ENH Various changes via static analysis tooling 2022-08-24 12:14:32 +12:00
Guy Sartorelli 35d5f16286
Merge pull request #10274 from tiller1010/check-for-dot-syntax-component
Check for component before saving, fallback to full form field name
2022-05-09 15:15:50 +12:00
Steve Boyd 511b3bb060 ENH PHP 8.1 compatibility 2022-04-14 13:12:59 +12:00
Tyler 13b81c5e38 Check for component before saving, fallback to full form field name 2022-04-05 14:39:23 -04:00
Loz Calver cb37e5fb87 FIX: Ensure extra classes are copied over to readonly/disabled fields 2021-12-17 09:16:43 +00:00
Maxime Rainville b43d68f9b4 API Add an AttributesHTML trait 2021-11-18 15:31:01 +13:00
GuySartorelli fc349db511
API Add a way to check if a form or form field has an extra css class (#10112)
Required for silverstripe/silverstripe-admin#1252
2021-11-01 17:01:17 +13:00
Steve Boyd a90d46dbc4 NEW Title tips for form fields 2021-07-31 14:45:24 +12:00
Sam Minnee 02fb7c3b17 NEW: Support dot syntax in form field names
This change adds support for these in a few places.

 - Form::saveInto($record)
 - Form::loadDataForm($record)
 - Form::loadDataForm($_POST)

Fixes https://github.com/silverstripe/silverstripe-framework/issues/9163
2021-05-20 20:32:24 +12:00
Nicolaas b75860b195
PATCH: fix param in docblock ... add \ to FormField::__construct 2021-04-05 19:43:41 +12:00
William Desportes c932d7e7fb
Fix the phpdoc blocks 2020-12-21 22:23:23 +01:00
Robbie Averill 27bd5d12e3 ENH Replace E_USER_ERROR errors with exceptions 2020-09-24 23:51:21 -07:00
Daniel Hensby 237b2d5f74
Convert array delcarations to short array syntax 2020-04-20 18:58:09 +01:00
Maxime Rainville acd7d94167 Merge branch '4.4' into 4.5 2020-02-17 13:07:26 +13:00
Serge Latyntcev ad1b00ec7d [CVE-2019-19325] XSS through non-scalar FormField attributes
Silverstripe Forms allow malicious HTML or JavaScript to be inserted
through non-scalar FormField attributes, which allows performing XSS (Cross-Site Scripting)
on some forms built with user input (Request data). This can lead to phishing attempts
to obtain a user's credentials or other sensitive user input.
There is no known attack vector for extracting user-session information or credentials automatically,
it required a user to fall for the phishing attempt.
XSS can also be used to modify the presentation of content in malicious ways.
2020-02-17 09:58:29 +13:00
JorisDebonnet 349589b23b
Clarify that $title in FormField can accept ViewableData
When constructing a FormField, an IDE would previously tell you the `$title` needs to be string (or null). Let's make it more clear that a ViewableData instance (such as `HTMLValue::create($title)`) is also accepted. This should help people more quickly find a solution to put html in labels.
2019-09-26 02:39:39 +02:00
Nicholas Sorokin 4a32b3418a Add onBeforeRenderHolder extension point for FormField 2019-08-09 14:43:14 +09:30
Robbie Averill 14673ffd0a Merge branch '4.3' into 4.4 2019-05-30 09:35:26 +12:00
shoosah 4da8be3bf5 Add extend function in getSchemaValidation function
This allows to create extensions which add validation list
2019-05-14 09:47:14 +12:00
Robbie Averill 394dd4765c NEW Scaffolded field labels now only have an uppercased first word 2019-01-07 17:52:28 +01:00
Will Rossiter 66a404ad1a FIX use Injector for FormField::castedCopy
Allows LookupField to be replaced with user specificed classes.
2018-10-24 12:13:14 +13:00
Thomas Portelange fdd5acff5d
raw2att accepts array, but sprintf doesn't
it's not very likely to happen (it did in my case :-) ) but if the value is an array, sprintf will fail (because raw2att accepts array, but sprintf doesn't). i suggest to json encode any array data to ensure it's safely included in the html. Or we should throw proper exceptions to make sure invalid values do not result in a php error.
2018-09-27 12:12:59 +02:00
Thomas Portelange f103648f8c
value can be something else than a string
if the value is not a string (an array for instance), sprintf will fail
2018-09-26 11:35:40 +02:00
Robbie Averill b93e94c0c3
FIX FormField::Link now throws a LogicException if no form is set yet 2018-07-16 13:02:58 +01:00
Damian Mooyman 386ef27f65
Update requesthandlers with missing extension points 2018-03-23 15:28:00 +13:00
Damian Mooyman 625f7b4eee
Merge remote-tracking branch 'origin/4.0' into 4.1 2018-03-13 14:26:18 +13:00
Damian Mooyman 32637413de ENHANCEMENT Improve upgrade rules to support advanced upgrader rewrites (#7903)
* ENHANCEMENT Improve upgrade rules to support advanced upgrader rewrites

* Minor: Grammar fixes.
2018-03-05 15:47:06 +13:00
Damian Mooyman e359948eb3
Merge remote-tracking branch 'origin/4.0' into 4
# Conflicts:
#	src/Core/CoreKernel.php
2018-02-05 17:52:38 +13:00
Robbie Averill c0ffe2797a Update phpdoc for FormField::setRightTitle regarding escaped HTML 2018-01-31 11:03:35 +13:00
Andrew Aitken-Fincham 3274f29c00 sanitise more docblocks 2017-11-14 10:02:24 +00:00
Andrew Aitken-Fincham 25d8795c70 sanitise FormField docblock 2017-11-14 09:52:06 +00:00
Damian Mooyman eff5c28f24
Adjust FormField::onBeforeRendor so that it can influence both context and passed properties
Fixes #7466
2017-10-11 11:43:57 +13:00
Robbie Averill 595ba75a50 API Make FormField::hasClass return a boolean instead of an int 2017-08-23 16:23:28 +12:00
Damian Mooyman 64e802f795
API Move createTag to HTML class
ENHANCEMENT Better HTML generation behaviour for Requirements_Backend
2017-06-16 12:22:05 +12:00
Damian Mooyman fba8e2c245 API Remove Object class
API DataObjectSchema::manyManyComponent() return array is now associative array
2017-05-23 13:50:35 +12:00
Saophalkun Ponlu 1ec7c4e523 Fix lint error 2017-05-16 11:53:23 +12:00
Saophalkun Ponlu a975b88661 Pass autofocus flag to front-end 2017-05-16 11:53:23 +12:00
Daniel Hensby e741af9127
Merge branch 'pull/6905' 2017-05-12 12:21:02 +01:00
Ralph Slooten 43a122cc36 Fix for meta closing tags
Prevent html errors when FormField::create_tag('meta') is called from $MetaTags() so
```
<meta name="generator" content="SilverStripe - http://silverstripe.org"></meta>
```
becomes
```
<meta name="generator" content="SilverStripe - http://silverstripe.org" />
```

Add all void elements to list
2017-05-12 08:49:15 +12:00
Christopher Joe 403f4db14d Fix change titles to return schema values in schema
Enhancement Add EditorExternalLink call for toolbar
2017-05-11 09:57:55 +12:00
Saophalkun Ponlu 97dac7028c De-couple schema type and type attribute 2017-05-09 16:50:33 +12:00
Ingo Schommer 1d438d3fb5 API Remove deprecated FormAction::createTag() 2017-05-09 11:38:35 +12:00
Ingo Schommer cbe534c675 Fixed component capitalisation 2017-04-27 15:36:18 +12:00
Damian Mooyman 3362e15a29 API Upgrade code to use updated config 2017-02-27 16:54:01 +13:00
Damian Mooyman 029a8b9586
API Substitute Zend_Currency with NumberFormatter based solution
API Substitute Zend_Locale with Locale / NumberFormatter
API Substitute Zend_Date with IntlDateFormatter
API Added DBTIme::Nice12, FormatFromSettings
API Added Short() method to DBDate / DBTime / DBDatetime
API Add Date::getTimestamp()
API Added setSubmittedValue api for FormField
API Add second arg to base FormField::setValue()
API Major refactor of i18n into component data parts
API Implement Resettable interface to reset objects between tests
ENHANCEMENT Changed DBField::create_field return type to `static` to support better type hinting
ENHANCEMENT i18nTextCollector supports __CLASS__
2017-02-09 15:28:59 +13:00
Colin Tucker 34398b0faa Cast SmallFieldHolder to HTMLFragment - fixes #6568 2017-01-27 09:16:58 +11:00
Damian Mooyman 6e589aac75
API Updates to Form, ValidationResponse, ValidationException
API Implement form schema "errors" handling
2016-12-09 14:24:11 +13:00
Daniel Hensby c6d43b477e
Merge branch '3' 2016-11-29 13:27:49 +00:00