From 1efed5500d0020a19d79bc8128c3d5bde4646b31 Mon Sep 17 00:00:00 2001 From: webchick <webchick@24967.no-reply.drupal.org> Date: Wed, 4 Dec 2013 08:00:58 -0800 Subject: [PATCH] Issue #2123843 by damiankloip: Camelize views form methods. --- .../node/Plugin/views/field/NodeBulkForm.php | 6 ++--- .../Plugin/views/field/BulkFormBase.php | 4 ++-- .../user/Plugin/views/field/UserBulkForm.php | 6 ++--- .../Drupal/views/Form/ViewsFormMainForm.php | 24 +++++++++---------- .../Plugin/views/field/ActionBulkForm.php | 6 ++--- core/modules/views/views.module | 4 ++-- 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/core/modules/node/lib/Drupal/node/Plugin/views/field/NodeBulkForm.php b/core/modules/node/lib/Drupal/node/Plugin/views/field/NodeBulkForm.php index 418610a84254..1fcd4cddd3c0 100644 --- a/core/modules/node/lib/Drupal/node/Plugin/views/field/NodeBulkForm.php +++ b/core/modules/node/lib/Drupal/node/Plugin/views/field/NodeBulkForm.php @@ -34,7 +34,7 @@ public function __construct(array $configuration, $plugin_id, array $plugin_defi /** * {@inheritdoc} */ - public function views_form_validate(&$form, &$form_state) { + public function viewsFormValidate(&$form, &$form_state) { $selected = array_filter($form_state['values'][$this->options['id']]); if (empty($selected)) { form_set_error('', $form_state, t('No items selected.')); @@ -44,8 +44,8 @@ public function views_form_validate(&$form, &$form_state) { /** * {@inheritdoc} */ - public function views_form_submit(&$form, &$form_state) { - parent::views_form_submit($form, $form_state); + public function viewsFormSubmit(&$form, &$form_state) { + parent::viewsFormSubmit($form, $form_state); if ($form_state['step'] == 'views_form_views_form') { Cache::invalidateTags(array('content' => TRUE)); } diff --git a/core/modules/system/lib/Drupal/system/Plugin/views/field/BulkFormBase.php b/core/modules/system/lib/Drupal/system/Plugin/views/field/BulkFormBase.php index a14e0599f6d8..ceee2e2046d7 100644 --- a/core/modules/system/lib/Drupal/system/Plugin/views/field/BulkFormBase.php +++ b/core/modules/system/lib/Drupal/system/Plugin/views/field/BulkFormBase.php @@ -105,7 +105,7 @@ public function preRender(&$values) { * @param array $form_state * An associative array containing the current state of the form. */ - public function views_form(&$form, &$form_state) { + public function viewsForm(&$form, &$form_state) { // Add the tableselect javascript. $form['#attached']['library'][] = array('system', 'drupal.tableselect'); @@ -173,7 +173,7 @@ protected function getBulkOptions() { * @param array $form_state * An associative array containing the current state of the form. */ - public function views_form_submit(&$form, &$form_state) { + public function viewsFormSubmit(&$form, &$form_state) { if ($form_state['step'] == 'views_form_views_form') { // Filter only selected checkboxes. $selected = array_filter($form_state['values'][$this->options['id']]); diff --git a/core/modules/user/lib/Drupal/user/Plugin/views/field/UserBulkForm.php b/core/modules/user/lib/Drupal/user/Plugin/views/field/UserBulkForm.php index 5aac6985dab4..ea6d67a2fd89 100644 --- a/core/modules/user/lib/Drupal/user/Plugin/views/field/UserBulkForm.php +++ b/core/modules/user/lib/Drupal/user/Plugin/views/field/UserBulkForm.php @@ -38,8 +38,8 @@ public function __construct(array $configuration, $plugin_id, array $plugin_defi * * Provide a more useful title to improve the accessibility. */ - public function views_form(&$form, &$form_state) { - parent::views_form($form, $form_state); + public function viewsForm(&$form, &$form_state) { + parent::viewsForm($form, $form_state); if (!empty($this->view->result)) { foreach ($this->view->result as $row_index => $result) { @@ -54,7 +54,7 @@ public function views_form(&$form, &$form_state) { /** * {@inheritdoc} */ - public function views_form_validate(&$form, &$form_state) { + public function viewsFormValidate(&$form, &$form_state) { $selected = array_filter($form_state['values'][$this->options['id']]); if (empty($selected)) { form_set_error('', $form_state, t('No users selected.')); diff --git a/core/modules/views/lib/Drupal/views/Form/ViewsFormMainForm.php b/core/modules/views/lib/Drupal/views/Form/ViewsFormMainForm.php index a5dbd1538a54..98cdc4f97f7a 100644 --- a/core/modules/views/lib/Drupal/views/Form/ViewsFormMainForm.php +++ b/core/modules/views/lib/Drupal/views/Form/ViewsFormMainForm.php @@ -62,8 +62,8 @@ public function buildForm(array $form, array &$form_state, ViewExecutable $view $callback($view, $field, $form, $form_state); $has_form = TRUE; } - elseif (method_exists($field, 'views_form')) { - $field->views_form($form, $form_state); + elseif (method_exists($field, 'viewsForm')) { + $field->viewsForm($form, $form_state); $has_form = TRUE; } @@ -90,8 +90,8 @@ public function buildForm(array $form, array &$form_state, ViewExecutable $view $area_handlers = array_merge(array_values($view->header), array_values($view->footer)); $empty = empty($view->result); foreach ($area_handlers as $area) { - if (method_exists($area, 'views_form') && !$area->views_form_empty($empty)) { - $area->views_form($form, $form_state); + if (method_exists($area, 'viewsForm') && !$area->viewsFormEmpty($empty)) { + $area->viewsForm($form, $form_state); } } @@ -111,16 +111,16 @@ public function validateForm(array &$form, array &$form_state) { // Call the validation method on every field handler that has it. foreach ($view->field as $field) { - if (method_exists($field, 'views_form_validate')) { - $field->views_form_validate($form, $form_state); + if (method_exists($field, 'viewsFormValidate')) { + $field->viewsFormValidate($form, $form_state); } } // Call the validate method on every area handler that has it. foreach (array('header', 'footer') as $area) { foreach ($view->{$area} as $area_handler) { - if (method_exists($area_handler, 'views_form_validate')) { - $area_handler->views_form_validate($form, $form_state); + if (method_exists($area_handler, 'viewsFormValidate')) { + $area_handler->viewsFormValidate($form, $form_state); } } } @@ -134,16 +134,16 @@ public function submitForm(array &$form, array &$form_state) { // Call the submit method on every field handler that has it. foreach ($view->field as $field) { - if (method_exists($field, 'views_form_submit')) { - $field->views_form_submit($form, $form_state); + if (method_exists($field, 'viewsFormSubmit')) { + $field->viewsFormSubmit($form, $form_state); } } // Call the submit method on every area handler that has it. foreach (array('header', 'footer') as $area) { foreach ($view->{$area} as $area_handler) { - if (method_exists($area_handler, 'views_form_submit')) { - $area_handler->views_form_submit($form, $form_state); + if (method_exists($area_handler, 'viewsFormSubmit')) { + $area_handler->viewsFormSubmit($form, $form_state); } } } diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/field/ActionBulkForm.php b/core/modules/views/lib/Drupal/views/Plugin/views/field/ActionBulkForm.php index ba2356c825bd..a6eef9054779 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/field/ActionBulkForm.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/field/ActionBulkForm.php @@ -98,10 +98,10 @@ protected function getBulkOptions($filtered = TRUE) { } /** - * Implements \Drupal\system\Plugin\views\field\BulkFormBase::views_form_submit(). + * Implements \Drupal\system\Plugin\views\field\BulkFormBase::viewsFormSubmit(). */ - public function views_form_submit(&$form, &$form_state) { - parent::views_form_submit($form, $form_state); + public function viewsFormSubmit(&$form, &$form_state) { + parent::viewsFormSubmit($form, $form_state); if ($form_state['step'] == 'views_form_views_form') { $count = count(array_filter($form_state['values'][$this->options['id']])); $action = $this->actions[$form_state['values']['action']]; diff --git a/core/modules/views/views.module b/core/modules/views/views.module index c33ab873dcea..7954af0a27ac 100644 --- a/core/modules/views/views.module +++ b/core/modules/views/views.module @@ -990,14 +990,14 @@ function views_get_view($name) { */ function views_view_has_form_elements($view) { foreach ($view->field as $field) { - if (property_exists($field, 'views_form_callback') || method_exists($field, 'views_form')) { + if (property_exists($field, 'views_form_callback') || method_exists($field, 'viewsForm')) { return TRUE; } } $area_handlers = array_merge(array_values($view->header), array_values($view->footer)); $empty = empty($view->result); foreach ($area_handlers as $area) { - if (method_exists($area, 'views_form') && !$area->views_form_empty($empty)) { + if (method_exists($area, 'viewsForm') && !$area->viewsFormEmpty($empty)) { return TRUE; } } -- GitLab