Skip to content
Snippets Groups Projects
Commit 1efed550 authored by Angie Byron's avatar Angie Byron
Browse files

Issue #2123843 by damiankloip: Camelize views form methods.

parent 980fa7ed
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -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));
}
......
......@@ -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']]);
......
......@@ -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.'));
......
......@@ -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);
}
}
}
......
......@@ -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']];
......
......@@ -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;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment