Comments

bfr’s picture

Phew. That was hard work :)

bfr’s picture

Status: Active » Needs review
bfr’s picture

Fixed few intendation mistakes.

cs_shadow’s picture

Changes look good. I just have a small nitpick to point out:

+++ b/core/modules/views/src/Plugin/views/pager/SqlBase.php
@@ -195,16 +195,14 @@ public function validateOptionsForm(&$form, &$form_state) {
     }
...
-        form_set_error('pager_options][expose][items_per_page_options', $form_state, t('Insert the items per page (@items_per_page) from above.',
-            array('@items_per_page' => $items_per_page))
-        );
+        \Drupal::formBuilder()->setErrorByName('pager_options][expose][items_per_page_options', $form_state, t('Insert the items per page (@items_per_page) from above.', array('@items_per_page' => $items_per_page)));

Should we retain the line break for array here?

bfr’s picture

I was thinking about that, but i don't really understand the line break from coding standards perspective. We COULD break it (about)like this if we really wanted to:

\Drupal::formBuilder()->setErrorByName('pager_options][expose][items_per_page_options', $form_state, t('Insert the items per page (@items_per_page) from above.', array(
  '@items_per_page' => $items_per_page, // Note also the added comma as per coding standards
)));
cs_shadow’s picture

I'm in favor of doing it. AFAIK if the length of the line containing array is more than 80 chars, then the array must be split to a new line.

Agree that you version in #5 is the better way to do it.

bfr’s picture

Ok, i fixed it like that, but if you look closely you'll notice that the line is still way over 80 characters - and so it was in the original file. Maybe a new, novice tagged issue is needed for the coding standards? Seems like core is full of these insanely long, over 200 character lines.

herom’s picture

rerolled. replaced two more "form_set_error" calls, fixed indentation, and removed a few optional parameters.

tim.plunkett’s picture

Status: Needs review » Postponed

Please wait on this, we're changing how setErrorByName works in #2225353: Convert $form_state to an object and provide methods like setError()

herom’s picture

Title: Replace calls to form_set_error() to formBuilder->setErrorByName() » Replace calls to form_set_error() to $form_state->setErrorByName()
Assigned: bfr » Unassigned
Status: Postponed » Needs review
Issue tags: +FormState
StatusFileSize
new25.45 KB
ashutoshsngh’s picture

Status: Needs review » Reviewed & tested by the community

Last submitted patch worked fine.No trace of form_set_error found.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/modules/system/system.module
@@ -8,6 +8,7 @@
@@ -1120,16 +1121,17 @@ function system_check_directory($form_element) {

@@ -1120,16 +1121,17 @@ function system_check_directory($form_element) {
+  $form_state = new FormState();
   $logger = \Drupal::logger('file system');

Actaully this method is used in a #after_build callback and the second argument is the form state so let's fix that. This looks wrong. See views_ui_add_ajax_wrapper() for an example of an #after_build function.

herom’s picture

StatusFileSize
new921 bytes
new25.92 KB

fixed #12.

herom’s picture

Status: Needs work » Needs review
tim.plunkett’s picture

So can we please remove the function as well, to avoid adding it back again?

herom’s picture

StatusFileSize
new754 bytes
new26.65 KB

Sure.

tim.plunkett’s picture

Status: Needs review » Reviewed & tested by the community

Thanks! (RTBC if it passes)

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 7fff6e8 and pushed to 8.0.x. Thanks!

  • alexpott committed 7fff6e8 on 8.0.x
    Issue #2297875 by herom, bfr: Replace calls to form_set_error() to $...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.