Issue #1765728 by dawehner, damiankloip: Cleanup methods on HandlerBase.

8.0.x
Daniel Wehner 2012-09-01 14:07:43 +02:00 committed by Tim Plunkett
parent 69fa3f1657
commit 774ef63ca4
128 changed files with 426 additions and 424 deletions

View File

@ -107,7 +107,7 @@ Example change for views_plugin_argument_validate_user:
),
</pre>
<h3>The introduction of get_value() and sanitize_value()</h3>
<h3>The introduction of get_value() and sanitizeValue()</h3>
The views_handler class got two new functions:
<pre>
/**
@ -133,7 +133,7 @@ function get_value($values, $field = NULL) {
* @param $type
* The type of sanitization needed. If not provided, check_plain() is used.
*/
function sanitize_value($value, $type = NULL) {
public function sanitizeValue($value, $type = NULL) {
switch ($type) {
case 'xss':
$value = filter_xss($value);
@ -158,7 +158,7 @@ all of the logic there (as well as having to constantly keep up with upstream Vi
the backend can just override get_values(), which is significantly less code.
Of course, different ways of fetching and displaying data might require different
ways of sanitizing it, hence the usage of the sanitize_value() function.
ways of sanitizing it, hence the usage of the sanitizeValue() function.
Examples of converting render() field handler implementations:
<pre>
@ -175,12 +175,12 @@ $format = $this->get_values($values, 'format');
// Instead of this:
return check_plain($value);
// We write:
return $this->sanitize_value($value);
return $this->sanitizeValue($value);
// Since sanitize_value() supports different sanitization functions, this:
// Since sanitizeValue() supports different sanitization functions, this:
return filter_xss($value);
// Can become:
return $this->sanitize_value($value, 'xss');
return $this->sanitizeValue($value, 'xss');
</pre>

View File

@ -2276,12 +2276,12 @@ function views_ui_edit_form_get_bucket($type, $view, $display) {
continue;
}
$field_name = check_plain($handler->ui_name(TRUE));
$field_name = check_plain($handler->uiName(TRUE));
if (!empty($field['relationship']) && !empty($relationships[$field['relationship']])) {
$field_name = '(' . $relationships[$field['relationship']] . ') ' . $field_name;
}
$description = filter_xss_admin($handler->admin_summary());
$description = filter_xss_admin($handler->adminSummary());
$link_text = $field_name . (empty($description) ? '' : " ($description)");
$link_attributes = array('class' => array('views-ajax-link'));
if (!empty($field['exclude'])) {
@ -2294,11 +2294,11 @@ function views_ui_edit_form_get_bucket($type, $view, $display) {
$build['fields'][$id]['#changed'] = TRUE;
}
if ($display->handler->useGroupBy() && $handler->use_group_by()) {
if ($display->handler->useGroupBy() && $handler->usesGroupBy()) {
$build['fields'][$id]['#settings_links'][] = l('<span class="label">' . t('Aggregation settings') . '</span>', "admin/structure/views/nojs/config-item-group/$view->name/$display->id/$type/$id", array('attributes' => array('class' => 'views-button-configure views-ajax-link', 'title' => t('Aggregation settings')), 'html' => TRUE));
}
if ($handler->has_extra_options()) {
if ($handler->hasExtraOptions()) {
$build['fields'][$id]['#settings_links'][] = l('<span class="label">' . t('Settings') . '</span>', "admin/structure/views/nojs/config-item-extra/$view->name/$display->id/$type/$id", array('attributes' => array('class' => array('views-button-configure', 'views-ajax-link'), 'title' => t('Settings')), 'html' => TRUE));
}
@ -3371,7 +3371,7 @@ function views_ui_rearrange_form($form, &$form_state) {
);
$handler = $display->handler->getHandler($type, $id);
if ($handler) {
$name = $handler->ui_name() . ' ' . $handler->admin_summary();
$name = $handler->uiName() . ' ' . $handler->adminSummary();
if (!empty($field['relationship']) && !empty($relationships[$field['relationship']])) {
$name = '(' . $relationships[$field['relationship']] . ') ' . $name;
}
@ -3726,7 +3726,7 @@ function views_ui_rearrange_filter_form($form, &$form_state) {
);
if ($handler) {
$name = $handler->ui_name() . ' ' . $handler->admin_summary();
$name = $handler->uiName() . ' ' . $handler->adminSummary();
if (!empty($field['relationship']) && !empty($relationships[$field['relationship']])) {
$name = '(' . $relationships[$field['relationship']] . ') ' . $name;
}
@ -4136,12 +4136,12 @@ function views_ui_add_item_form_submit($form, &$form_state) {
$key = $types[$type]['type'];
}
$handler = views_get_handler($table, $field, $key);
if ($form_state['view']->display_handler->useGroupBy() && $handler->use_group_by()) {
if ($form_state['view']->display_handler->useGroupBy() && $handler->usesGroupBy()) {
views_ui_add_form_to_stack('config-item-group', $form_state['view'], $form_state['display_id'], array($type, $id));
}
// check to see if this type has settings, if so add the settings form first
if ($handler && $handler->has_extra_options()) {
if ($handler && $handler->hasExtraOptions()) {
views_ui_add_form_to_stack('config-item-extra', $form_state['view'], $form_state['display_id'], array($type, $id));
}
// Then add the form to the stack
@ -4293,7 +4293,7 @@ function views_ui_config_item_form($form, &$form_state) {
);
}
$form['#title'] = t('Configure @type: @item', array('@type' => $types[$type]['lstitle'], '@item' => $handler->ui_name()));
$form['#title'] = t('Configure @type: @item', array('@type' => $types[$type]['lstitle'], '@item' => $handler->uiName()));
if (!empty($handler->definition['help'])) {
$form['options']['form_description'] = array(
@ -4476,9 +4476,9 @@ function views_ui_config_item_group_form($type, &$form_state) {
$handler->init($view, $item);
$types = View::viewsObjectTypes();
$form['#title'] = t('Configure group settings for @type %item', array('@type' => $types[$type]['lstitle'], '%item' => $handler->ui_name()));
$form['#title'] = t('Configure group settings for @type %item', array('@type' => $types[$type]['lstitle'], '%item' => $handler->uiName()));
$handler->groupby_form($form['options'], $form_state);
$handler->buildGroupByForm($form['options'], $form_state);
$form_state['handler'] = &$handler;
}
@ -4498,7 +4498,7 @@ function views_ui_config_item_group_form_submit($form, &$form_state) {
$handler = views_get_handler($item['table'], $item['field'], $type);
$handler->init($form_state['view'], $item);
$handler->groupby_form_submit($form, $form_state);
$handler->submitGroupByForm($form, $form_state);
// Store the item back on the view
$form_state['view']->setItem($form_state['display_id'], $form_state['type'], $form_state['id'], $item);
@ -4534,7 +4534,7 @@ function views_ui_config_item_form_expose($form, &$form_state) {
// If necessary, set new defaults:
if ($item['exposed']) {
$form_state['handler']->expose_options();
$form_state['handler']->defaultExposeOptions();
}
$form_state['view']->setItem($form_state['display_id'], $form_state['type'], $form_state['id'], $item);
@ -4577,12 +4577,12 @@ function views_ui_config_item_extra_form($form, &$form_state) {
$handler->init($view, $item);
$types = View::viewsObjectTypes();
$form['#title'] = t('Configure extra settings for @type %item', array('@type' => $types[$type]['lstitle'], '%item' => $handler->ui_name()));
$form['#title'] = t('Configure extra settings for @type %item', array('@type' => $types[$type]['lstitle'], '%item' => $handler->uiName()));
$form['#section'] = $display_id . '-' . $type . '-' . $id;
// Get form from the handler.
$handler->extra_options_form($form['options'], $form_state);
$handler->buildExtraOptionsForm($form['options'], $form_state);
$form_state['handler'] = &$handler;
}
@ -4595,7 +4595,7 @@ function views_ui_config_item_extra_form($form, &$form_state) {
* Validation handler for configing new item(s) to a view.
*/
function views_ui_config_item_extra_form_validate($form, &$form_state) {
$form_state['handler']->extra_options_validate($form['options'], $form_state);
$form_state['handler']->validateExtraOptionsForm($form['options'], $form_state);
}
/**
@ -4603,7 +4603,7 @@ function views_ui_config_item_extra_form_validate($form, &$form_state) {
*/
function views_ui_config_item_extra_form_submit($form, &$form_state) {
// Run it through the handler's submit function.
$form_state['handler']->extra_options_submit($form['options'], $form_state);
$form_state['handler']->submitExtraOptionsForm($form['options'], $form_state);
$item = $form_state['handler']->options;
// Store the data we're given.
@ -4648,7 +4648,7 @@ function views_ui_config_style_form($form, &$form_state) {
$handler->init($view, $item);
$types = View::viewsObjectTypes();
$form['#title'] = t('Configure summary style for @type %item', array('@type' => $types[$type]['lstitle'], '%item' => $handler->ui_name()));
$form['#title'] = t('Configure summary style for @type %item', array('@type' => $types[$type]['lstitle'], '%item' => $handler->uiName()));
$form['#section'] = $display_id . '-' . $type . '-style-options';

View File

@ -46,7 +46,7 @@ class ManyToOneHelper {
* it that option. If it wants us to do this, it must set $helper->formula = TRUE
* and implement handler->get_formula();
*/
function get_field() {
public function getField() {
if (!empty($this->formula)) {
return $this->handler->get_formula();
}
@ -68,7 +68,7 @@ class ManyToOneHelper {
$field = $this->handler->relationship . '_' . $this->handler->table . '.' . $this->handler->field;
if (empty($join)) {
$join = $this->get_join();
$join = $this->getJoin();
}
// See if there's a chain between us and the base relationship. If so, we need
@ -109,8 +109,8 @@ class ManyToOneHelper {
return $alias;
}
function get_join() {
return $this->handler->get_join();
public function getJoin() {
return $this->handler->getJoin();
}
/**
@ -119,7 +119,7 @@ class ManyToOneHelper {
*/
function summary_join() {
$field = $this->handler->relationship . '_' . $this->handler->table . '.' . $this->handler->field;
$join = $this->get_join();
$join = $this->getJoin();
// shortcuts
$options = $this->handler->options;
@ -151,10 +151,10 @@ class ManyToOneHelper {
}
/**
* Override ensure_my_table so we can control how this joins in.
* Override ensureMyTable so we can control how this joins in.
* The operator actually has influence over joining.
*/
function ensure_my_table() {
public function ensureMyTable() {
if (!isset($this->handler->table_alias)) {
// Case 1: Operator is an 'or' and we're not reducing duplicates.
// We hence get the absolute simplest:
@ -163,7 +163,7 @@ class ManyToOneHelper {
if (empty($this->handler->options['add_table']) && empty($this->handler->view->many_to_one_tables[$field])) {
// query optimization, INNER joins are slightly faster, so use them
// when we know we can.
$join = $this->get_join();
$join = $this->getJoin();
if (isset($join)) {
$join->type = 'INNER';
}
@ -171,7 +171,7 @@ class ManyToOneHelper {
$this->handler->view->many_to_one_tables[$field] = $this->handler->value;
}
else {
$join = $this->get_join();
$join = $this->getJoin();
$join->type = 'LEFT';
if (!empty($this->handler->view->many_to_one_tables[$field])) {
foreach ($this->handler->view->many_to_one_tables[$field] as $value) {
@ -198,7 +198,7 @@ class ManyToOneHelper {
// Clone the join for each table:
$this->handler->table_aliases = array();
foreach ($this->handler->value as $value) {
$join = $this->get_join();
$join = $this->getJoin();
if ($this->handler->operator == 'and') {
$join->type = 'INNER';
}
@ -230,7 +230,7 @@ class ManyToOneHelper {
// We just do one join. We'll add a where clause during
// the query phase to ensure that $table.$field IS NULL.
else {
$join = $this->get_join();
$join = $this->getJoin();
$join->type = 'LEFT';
$join->extra = array();
$join->extra_type = 'OR';
@ -251,7 +251,7 @@ class ManyToOneHelper {
/**
* Provides a unique placeholders for handlers.
*/
function placeholder() {
protected function placeholder() {
return $this->handler->query->placeholder($this->handler->options['table'] . '_' . $this->handler->options['field']);
}
@ -259,10 +259,10 @@ class ManyToOneHelper {
if (empty($this->handler->value)) {
return;
}
$this->handler->ensure_my_table();
$this->handler->ensureMyTable();
// Shorten some variables:
$field = $this->get_field();
$field = $this->getField();
$options = $this->handler->options;
$operator = $this->handler->operator;
$formula = !empty($this->formula);

View File

@ -78,7 +78,7 @@ abstract class HandlerBase extends PluginBase {
* The item from the database; the actual contents of this will vary
* based upon the type of handler.
*/
function init(&$view, &$options) {
public function init(&$view, &$options) {
$this->view = &$view;
$display_id = $this->view->current_display;
// Check to see if this handler type is defaulted. Note that
@ -143,7 +143,7 @@ abstract class HandlerBase extends PluginBase {
$options['field'] = array('default' => '');
$options['relationship'] = array('default' => 'none');
$options['group_type'] = array('default' => 'group');
$options['ui_name'] = array('default' => '');
$options['ui_name'] = array('default' => '', 'translatable' => TRUE);
return $options;
}
@ -151,7 +151,7 @@ abstract class HandlerBase extends PluginBase {
/**
* Return a string representing this handler's name in the UI.
*/
function ui_name($short = FALSE) {
public function uiName($short = FALSE) {
if (!empty($this->options['ui_name'])) {
$title = check_plain($this->options['ui_name']);
return $title;
@ -165,9 +165,9 @@ abstract class HandlerBase extends PluginBase {
*
* This should be overridden for handlers with formulae or other
* non-standard fields. Because this takes an argument, fields
* overriding this can just call return parent::get_field($formula)
* overriding this can just call return parent::getField($formula)
*/
function get_field($field = NULL) {
public function getField($field = NULL) {
if (!isset($field)) {
if (!empty($this->formula)) {
$field = $this->get_formula();
@ -205,7 +205,7 @@ abstract class HandlerBase extends PluginBase {
* @return string
* Returns the safe value.
*/
function sanitize_value($value, $type = NULL) {
protected function sanitizeValue($value, $type = NULL) {
switch ($type) {
case 'xss':
$value = filter_xss($value);
@ -238,7 +238,7 @@ abstract class HandlerBase extends PluginBase {
* @return string
* The transformed string.
*/
function case_transform($string, $option) {
protected function caseTransform($string, $option) {
global $multibyte;
switch ($option) {
@ -305,13 +305,13 @@ abstract class HandlerBase extends PluginBase {
/**
* Provides the handler some groupby.
*/
function use_group_by() {
public function usesGroupBy() {
return TRUE;
}
/**
* Provide a form for aggregation settings.
*/
function groupby_form(&$form, &$form_state) {
public function buildGroupByForm(&$form, &$form_state) {
$view = &$form_state['view'];
$display_id = $form_state['display_id'];
$types = View::viewsObjectTypes();
@ -319,7 +319,7 @@ abstract class HandlerBase extends PluginBase {
$id = $form_state['id'];
$form['#title'] = check_plain($view->display[$display_id]->display_title) . ': ';
$form['#title'] .= t('Configure aggregation settings for @type %item', array('@type' => $types[$type]['lstitle'], '%item' => $this->ui_name()));
$form['#title'] .= t('Configure aggregation settings for @type %item', array('@type' => $types[$type]['lstitle'], '%item' => $this->uiName()));
$form['#section'] = $display_id . '-' . $type . '-' . $id;
@ -342,7 +342,7 @@ abstract class HandlerBase extends PluginBase {
* Perform any necessary changes to the form values prior to storage.
* There is no need for this function to actually store the data.
*/
function groupby_form_submit(&$form, &$form_state) {
public function submitGroupByForm(&$form, &$form_state) {
$item =& $form_state['handler']->options;
$item['group_type'] = $form_state['values']['options']['group_type'];
@ -352,90 +352,90 @@ abstract class HandlerBase extends PluginBase {
* If a handler has 'extra options' it will get a little settings widget and
* another form called extra_options.
*/
function has_extra_options() { return FALSE; }
public function hasExtraOptions() { return FALSE; }
/**
* Provide defaults for the handler.
*/
function extra_options(&$option) { }
public function defineExtraOptions(&$option) { }
/**
* Provide a form for setting options.
*/
function extra_options_form(&$form, &$form_state) { }
public function buildExtraOptionsForm(&$form, &$form_state) { }
/**
* Validate the options form.
*/
function extra_options_validate($form, &$form_state) { }
public function validateExtraOptionsForm($form, &$form_state) { }
/**
* Perform any necessary changes to the form values prior to storage.
* There is no need for this function to actually store the data.
*/
function extra_options_submit($form, &$form_state) { }
public function submitExtraOptionsForm($form, &$form_state) { }
/**
* Determine if a handler can be exposed.
*/
function can_expose() { return FALSE; }
public function canExpose() { return FALSE; }
/**
* Set new exposed option defaults when exposed setting is flipped
* on.
*/
function expose_options() { }
public function defaultExposeOptions() { }
/**
* Get information about the exposed form for the form renderer.
*/
function exposed_info() { }
public function exposedInfo() { }
/**
* Render our chunk of the exposed handler form when selecting
*/
function exposed_form(&$form, &$form_state) { }
public function buildExposedForm(&$form, &$form_state) { }
/**
* Validate the exposed handler form
*/
function exposed_validate(&$form, &$form_state) { }
public function validateExposed(&$form, &$form_state) { }
/**
* Submit the exposed handler form
*/
function exposed_submit(&$form, &$form_state) { }
public function submitExposed(&$form, &$form_state) { }
/**
* Form for exposed handler options.
*/
function expose_form(&$form, &$form_state) { }
public function buildExposeForm(&$form, &$form_state) { }
/**
* Validate the options form.
*/
function expose_validate($form, &$form_state) { }
public function validateExposeForm($form, &$form_state) { }
/**
* Perform any necessary changes to the form exposes prior to storage.
* There is no need for this function to actually store the data.
*/
function expose_submit($form, &$form_state) { }
public function submitExposeForm($form, &$form_state) { }
/**
* Shortcut to display the expose/hide button.
*/
function show_expose_button(&$form, &$form_state) { }
public function showExposeButton(&$form, &$form_state) { }
/**
* Shortcut to display the exposed options form.
*/
function show_expose_form(&$form, &$form_state) {
public function showExposeForm(&$form, &$form_state) {
if (empty($this->options['exposed'])) {
return;
}
$this->expose_form($form, $form_state);
$this->buildExposeForm($form, $form_state);
// When we click the expose button, we add new gadgets to the form but they
// have no data in $_POST so their defaults get wiped out. This prevents
@ -455,7 +455,7 @@ abstract class HandlerBase extends PluginBase {
*
* @return boolean
*/
function access() {
public function access() {
if (isset($this->definition['access callback']) && function_exists($this->definition['access callback'])) {
if (isset($this->definition['access arguments']) && is_array($this->definition['access arguments'])) {
return call_user_func_array($this->definition['access callback'], $this->definition['access arguments']);
@ -472,7 +472,7 @@ abstract class HandlerBase extends PluginBase {
* This gives all the handlers some time to set up before any handler has
* been fully run.
*/
function pre_query() { }
public function preQuery() { }
/**
* Run after the view is executed, before the result is cached.
@ -481,12 +481,12 @@ abstract class HandlerBase extends PluginBase {
* used so that handlers that pull up secondary data can put it in the
* $values so that the raw data can be utilized externally.
*/
function post_execute(&$values) { }
public function postExecute(&$values) { }
/**
* Provides a unique placeholders for handlers.
*/
function placeholder() {
protected function placeholder() {
return $this->query->placeholder($this->options['table'] . '_' . $this->options['field']);
}
@ -494,7 +494,7 @@ abstract class HandlerBase extends PluginBase {
* Called just prior to query(), this lets a handler set up any relationship
* it needs.
*/
function set_relationship() {
public function setRelationship() {
// Ensure this gets set to something.
$this->relationship = NULL;
@ -524,7 +524,7 @@ abstract class HandlerBase extends PluginBase {
* Ensure the main table for this handler is in the query. This is used
* a lot.
*/
function ensure_my_table() {
public function ensureMyTable() {
if (!isset($this->table_alias)) {
$this->table_alias = $this->query->ensure_table($this->table, $this->relationship);
}
@ -534,14 +534,14 @@ abstract class HandlerBase extends PluginBase {
/**
* Provide text for the administrative summary
*/
function admin_summary() { }
public function adminSummary() { }
/**
* Determine if the argument needs a style plugin.
*
* @return TRUE/FALSE
*/
function needs_style_plugin() { return FALSE; }
public function needsStylePlugin() { return FALSE; }
/**
* Determine if this item is 'exposed', meaning it provides form elements
@ -549,31 +549,31 @@ abstract class HandlerBase extends PluginBase {
*
* @return TRUE/FALSE
*/
function is_exposed() {
public function isExposed() {
return !empty($this->options['exposed']);
}
/**
* Returns TRUE if the exposed filter works like a grouped filter.
*/
function is_a_group() { return FALSE; }
public function isAGroup() { return FALSE; }
/**
* Define if the exposed input has to be submitted multiple times.
* This is TRUE when exposed filters grouped are using checkboxes as
* widgets.
*/
function multiple_exposed_input() { return FALSE; }
public function multipleExposedInput() { return FALSE; }
/**
* Take input from exposed handlers and assign to this handler, if necessary.
*/
function accept_exposed_input($input) { return TRUE; }
public function acceptExposedInput($input) { return TRUE; }
/**
* If set to remember exposed input in the session, store it there.
*/
function store_exposed_input($input, $status) { return TRUE; }
public function storeExposedInput($input, $status) { return TRUE; }
/**
* Get the join object that should be used for this handler.
@ -582,7 +582,7 @@ abstract class HandlerBase extends PluginBase {
* getting the join if it is necessary to make some changes to it, such
* as adding an 'extra'.
*/
function get_join() {
public function getJoin() {
// get the join from this table that links back to the base table.
// Determine the primary table to seek
if (empty($this->query->relationships[$this->relationship])) {
@ -615,6 +615,6 @@ abstract class HandlerBase extends PluginBase {
* Determine if the handler is considered 'broken', meaning it's a
* a placeholder used when a handler can't be found.
*/
function broken() { }
public function broken() { }
}

View File

@ -30,7 +30,7 @@ abstract class AccessPluginBase extends PluginBase {
* @param $display
* The display handler.
*/
function init(&$view, &$display) {
public function init(&$view, &$display) {
$this->view = &$view;
$this->display = &$display;
@ -73,7 +73,7 @@ abstract class AccessPluginBase extends PluginBase {
/**
* Determine if the current user has access or not.
*/
function access($account) {
public function access($account) {
// default to no access control.
return TRUE;
}

View File

@ -28,7 +28,7 @@ class Permission extends AccessPluginBase {
*/
protected $usesOptions = TRUE;
function access($account) {
public function access($account) {
return views_check_perm($this->options['perm'], $account);
}

View File

@ -28,7 +28,7 @@ class Role extends AccessPluginBase {
*/
protected $usesOptions = TRUE;
function access($account) {
public function access($account) {
return views_check_roles(array_filter($this->options['role']), $account);
}

View File

@ -30,7 +30,7 @@ abstract class AreaPluginBase extends HandlerBase {
* Make sure that no result area handlers are set to be shown when the result
* is empty.
*/
function init(&$view, &$options) {
public function init(&$view, &$options) {
parent::init($view, $options);
if ($this->handler_type == 'empty') {
$this->options['empty'] = TRUE;
@ -38,9 +38,9 @@ abstract class AreaPluginBase extends HandlerBase {
}
/**
* Get this field's label.
* Get this area's label.
*/
function label() {
public function label() {
if (!isset($this->options['label'])) {
return $this->ui_name();
}
@ -61,7 +61,7 @@ abstract class AreaPluginBase extends HandlerBase {
/**
* Provide extra data to the administration form
*/
function admin_summary() {
public function adminSummary() {
return $this->label();
}
@ -78,6 +78,7 @@ abstract class AreaPluginBase extends HandlerBase {
'#description' => t('The label for this area that will be displayed only administratively.'),
);
if ($form_state['type'] != 'empty') {
$form['empty'] = array(
'#type' => 'checkbox',
@ -102,7 +103,7 @@ abstract class AreaPluginBase extends HandlerBase {
/**
* Area handlers shouldn't have groupby.
*/
function use_group_by() {
public function usesGroupBy() {
return FALSE;
}

View File

@ -20,11 +20,11 @@ use Drupal\Core\Annotation\Plugin;
*/
class Broken extends AreaPluginBase {
function ui_name($short = FALSE) {
public function uiName($short = FALSE) {
return t('Broken/missing handler');
}
function ensure_my_table() { /* No table to ensure! */ }
public function ensureMyTable() { /* No table to ensure! */ }
public function query($group_by = FALSE) { /* No query to run */ }
function render($empty = FALSE) { return ''; }
public function buildOptionsForm(&$form, &$form_state) {
@ -36,7 +36,7 @@ class Broken extends AreaPluginBase {
/**
* Determine if the handler is considered 'broken'
*/
function broken() {
public function broken() {
return TRUE;
}

View File

@ -49,13 +49,13 @@ class Text extends AreaPluginBase {
// Get a list of the available fields and arguments for token replacement.
$options = array();
foreach ($this->view->display_handler->getHandlers('field') as $field => $handler) {
$options[t('Fields')]["[$field]"] = $handler->ui_name();
$options[t('Fields')]["[$field]"] = $handler->uiName();
}
$count = 0; // This lets us prepare the key as we want it printed.
foreach ($this->view->display_handler->getHandlers('argument') as $arg => $handler) {
$options[t('Arguments')]['%' . ++$count] = t('@argument title', array('@argument' => $handler->ui_name()));
$options[t('Arguments')]['!' . $count] = t('@argument input', array('@argument' => $handler->ui_name()));
$options[t('Arguments')]['%' . ++$count] = t('@argument title', array('@argument' => $handler->uiName()));
$options[t('Arguments')]['!' . $count] = t('@argument input', array('@argument' => $handler->uiName()));
}
if (!empty($options)) {

View File

@ -55,7 +55,7 @@ class TextCustom extends AreaPluginBase {
if ($this->options['tokenize']) {
$value = $this->view->style_plugin->tokenize_value($value, 0);
}
return $this->sanitize_value($value, 'xss_admin');
return $this->sanitizeValue($value, 'xss_admin');
}
}

View File

@ -113,7 +113,7 @@ abstract class ArgumentPluginBase extends HandlerBase {
*
* @return TRUE/FALSE
*/
function needs_style_plugin() {
public function needsStylePlugin() {
$info = $this->default_actions($this->options['default_action']);
$validate_info = $this->default_actions($this->options['validate']['fail']);
return !empty($info['style plugin']) || !empty($validate_info['style plugin']);
@ -802,7 +802,7 @@ abstract class ArgumentPluginBase extends HandlerBase {
* The alias used to get the number of records (count) for this entry.
*/
function summary_query() {
$this->ensure_my_table();
$this->ensureMyTable();
// Add the field.
$this->base_alias = $this->query->add_field($this->table_alias, $this->real_field);
@ -907,7 +907,7 @@ abstract class ArgumentPluginBase extends HandlerBase {
* The argument sent may be found at $this->argument.
*/
public function query($group_by = FALSE) {
$this->ensure_my_table();
$this->ensureMyTable();
$this->query->add_where(0, "$this->table_alias.$this->real_field", $this->argument);
}

View File

@ -20,11 +20,11 @@ use Drupal\Core\Annotation\Plugin;
*/
class Broken extends ArgumentPluginBase {
function ui_name($short = FALSE) {
public function uiName($short = FALSE) {
return t('Broken/missing handler');
}
function ensure_my_table() { /* No table to ensure! */ }
public function ensureMyTable() { /* No table to ensure! */ }
public function query($group_by = FALSE) { /* No query to run */ }
public function buildOptionsForm(&$form, &$form_state) {
$form['markup'] = array(
@ -35,6 +35,6 @@ class Broken extends ArgumentPluginBase {
/**
* Determine if the handler is considered 'broken'
*/
function broken() { return TRUE; }
public function broken() { return TRUE; }
}

View File

@ -46,7 +46,7 @@ class Formula extends ArgumentPluginBase {
* Build the summary query based on a formula
*/
function summary_query() {
$this->ensure_my_table();
$this->ensureMyTable();
// Now that our table is secure, get our formula.
$formula = $this->get_formula();
@ -61,7 +61,7 @@ class Formula extends ArgumentPluginBase {
* Build the query based upon the formula
*/
public function query($group_by = FALSE) {
$this->ensure_my_table();
$this->ensureMyTable();
// Now that our table is secure, get our formula.
$placeholder = $this->placeholder();
$formula = $this->get_formula() .' = ' . $placeholder;

View File

@ -21,15 +21,15 @@ use Drupal\Core\Annotation\Plugin;
class GroupByNumeric extends ArgumentPluginBase {
public function query($group_by = FALSE) {
$this->ensure_my_table();
$field = $this->get_field();
$this->ensureMyTable();
$field = $this->getField();
$placeholder = $this->placeholder();
$this->query->add_having_expression(0, "$field = $placeholder", array($placeholder => $this->argument));
}
function ui_name($short = FALSE) {
return $this->get_field(parent::ui_name($short));
public function uiName($short = FALSE) {
return $this->getField(parent::uiName($short));
}
function get_sort_name() {

View File

@ -29,7 +29,7 @@ use Drupal\views\ManyToOneHelper;
*/
class ManyToOne extends ArgumentPluginBase {
function init(&$view, &$options) {
public function init(&$view, &$options) {
parent::init($view, $options);
$this->helper = new ManyToOneHelper($this);
@ -90,11 +90,11 @@ class ManyToOne extends ArgumentPluginBase {
}
/**
* Override ensure_my_table so we can control how this joins in.
* Override ensureMyTable so we can control how this joins in.
* The operator actually has influence over joining.
*/
function ensure_my_table() {
$this->helper->ensure_my_table();
public function ensureMyTable() {
$this->helper->ensureMyTable();
}
public function query($group_by = FALSE) {
@ -110,7 +110,7 @@ class ManyToOne extends ArgumentPluginBase {
}
}
if ($empty) {
parent::ensure_my_table();
parent::ensureMyTable();
$this->query->add_where(0, "$this->table_alias.$this->real_field", NULL, 'IS NULL');
return;
}
@ -159,7 +159,7 @@ class ManyToOne extends ArgumentPluginBase {
function summary_query() {
$field = $this->table . '.' . $this->field;
$join = $this->get_join();
$join = $this->getJoin();
if (!empty($this->options['require_value'])) {
$join->type = 'INNER';

View File

@ -97,7 +97,7 @@ class Numeric extends ArgumentPluginBase {
}
public function query($group_by = FALSE) {
$this->ensure_my_table();
$this->ensureMyTable();
if (!empty($this->options['break_phrase'])) {
views_break_phrase($this->argument, $this);

View File

@ -22,7 +22,7 @@ use Drupal\Core\Annotation\Plugin;
*/
class String extends ArgumentPluginBase {
function init(&$view, &$options) {
public function init(&$view, &$options) {
parent::init($view, $options);
if (!empty($this->definition['many to one'])) {
$this->helper = new ManyToOneHelper($this);
@ -144,7 +144,7 @@ class String extends ArgumentPluginBase {
*/
function summary_query() {
if (empty($this->definition['many to one'])) {
$this->ensure_my_table();
$this->ensureMyTable();
}
else {
$this->table_alias = $this->helper->summary_join();
@ -169,7 +169,7 @@ class String extends ArgumentPluginBase {
/**
* Get the formula for this argument.
*
* $this->ensure_my_table() MUST have been called prior to this.
* $this->ensureMyTable() MUST have been called prior to this.
*/
function get_formula() {
return "SUBSTRING($this->table_alias.$this->real_field, 1, " . intval($this->options['limit']) . ")";
@ -196,12 +196,12 @@ class String extends ArgumentPluginBase {
if (!empty($this->options['glossary'])) {
$this->helper->formula = TRUE;
}
$this->helper->ensure_my_table();
$this->helper->ensureMyTable();
$this->helper->add_filter();
return;
}
$this->ensure_my_table();
$this->ensureMyTable();
$formula = FALSE;
if (empty($this->options['glossary'])) {
$field = "$this->table_alias.$this->real_field";
@ -238,7 +238,7 @@ class String extends ArgumentPluginBase {
}
function summary_argument($data) {
$value = $this->case_transform($data->{$this->base_alias}, $this->options['path_case']);
$value = $this->caseTransform($data->{$this->base_alias}, $this->options['path_case']);
if (!empty($this->options['transform_dash'])) {
$value = strtr($value, ' ', '-');
}
@ -250,7 +250,7 @@ class String extends ArgumentPluginBase {
}
function title() {
$this->argument = $this->case_transform($this->argument, $this->options['case']);
$this->argument = $this->caseTransform($this->argument, $this->options['case']);
if (!empty($this->options['transform_dash'])) {
$this->argument = strtr($this->argument, '-', ' ');
}
@ -282,7 +282,7 @@ class String extends ArgumentPluginBase {
}
function summary_name($data) {
return $this->case_transform(parent::summary_name($data), $this->options['case']);
return $this->caseTransform(parent::summary_name($data), $this->options['case']);
}
}

View File

@ -33,7 +33,7 @@ abstract class ArgumentDefaultPluginBase extends PluginBase {
* Initialize this plugin with the view and the argument
* it is linked to.
*/
function init(&$view, &$argument, $options) {
public function init(&$view, &$argument, $options) {
$this->view = &$view;
$this->argument = &$argument;
@ -65,7 +65,7 @@ abstract class ArgumentDefaultPluginBase extends PluginBase {
* Determine if the administrator has the privileges to use this
* plugin
*/
function access() { return TRUE; }
public function access() { return TRUE; }
/**
* If we don't have access to the form but are showing it anyway, ensure that

View File

@ -46,7 +46,7 @@ class Php extends ArgumentDefaultPluginBase {
* Only let users with PHP block visibility permissions set/modify this
* default plugin.
*/
function access() {
public function access() {
return user_access('use PHP for settings');
}

View File

@ -26,7 +26,7 @@ abstract class ArgumentValidatorPluginBase extends PluginBase {
* Initialize this plugin with the view and the argument
* it is linked to.
*/
function init(&$view, &$argument, $options) {
public function init(&$view, &$argument, $options) {
$this->view = &$view;
$this->argument = &$argument;
@ -57,7 +57,7 @@ abstract class ArgumentValidatorPluginBase extends PluginBase {
/**
* Determine if the administrator has the privileges to use this plugin
*/
function access() { return TRUE; }
public function access() { return TRUE; }
/**
* If we don't have access to the form but are showing it anyway, ensure that

View File

@ -45,7 +45,7 @@ class Php extends ArgumentValidatorPluginBase {
* Only let users with PHP block visibility permissions set/modify this
* validate plugin.
*/
function access() {
public function access() {
return user_access('use PHP for settings');
}

View File

@ -59,7 +59,7 @@ abstract class CachePluginBase extends PluginBase {
* @param $display
* The display handler.
*/
function init(&$view, &$display) {
public function init(&$view, &$display) {
$this->view = &$view;
$this->display = &$display;

View File

@ -188,7 +188,7 @@ abstract class DisplayPluginBase extends PluginBase {
if (!isset($this->has_exposed)) {
foreach ($this->handlers as $type => $value) {
foreach ($this->view->$type as $id => $handler) {
if ($handler->can_expose() && $handler->is_exposed()) {
if ($handler->canExpose() && $handler->isExposed()) {
// one is all we need; if we find it, return true.
$this->has_exposed = TRUE;
return TRUE;
@ -324,7 +324,7 @@ abstract class DisplayPluginBase extends PluginBase {
}
if (!empty($this->view->argument) && $this->getOption('hide_attachment_summary')) {
foreach ($this->view->argument as $argument_id => $argument) {
if ($argument->needs_style_plugin() && empty($argument->argument_validated)) {
if ($argument->needsStylePlugin() && empty($argument->argument_validated)) {
return FALSE;
}
}
@ -943,7 +943,7 @@ abstract class DisplayPluginBase extends PluginBase {
$relationships[$relationship] = $label;
}
else {
$relationships[$relationship] = $handler->ui_name();
$relationships[$relationship] = $handler->uiName();
}
}
@ -956,7 +956,7 @@ abstract class DisplayPluginBase extends PluginBase {
$options[$id] = $label;
}
else {
$options[$id] = $handler->ui_name();
$options[$id] = $handler->uiName();
}
if (!empty($handler->options['relationship']) && !empty($relationships[$handler->options['relationship']])) {
$options[$id] = '(' . $relationships[$handler->options['relationship']] . ') ' . $options[$id];
@ -1717,8 +1717,8 @@ abstract class DisplayPluginBase extends PluginBase {
$options = array();
$count = 0; // This lets us prepare the key as we want it printed.
foreach ($this->view->display_handler->getHandlers('argument') as $arg => $handler) {
$options[t('Arguments')]['%' . ++$count] = t('@argument title', array('@argument' => $handler->ui_name()));
$options[t('Arguments')]['!' . $count] = t('@argument input', array('@argument' => $handler->ui_name()));
$options[t('Arguments')]['%' . ++$count] = t('@argument title', array('@argument' => $handler->uiName()));
$options[t('Arguments')]['!' . $count] = t('@argument input', array('@argument' => $handler->uiName()));
}
// Default text.
@ -1864,7 +1864,7 @@ abstract class DisplayPluginBase extends PluginBase {
if ($plugin->usesFields()) {
foreach ($this->getHandlers('field') as $id => $handler) {
$funcs[] = $this->optionLink(t('Field @field (ID: @id)', array('@field' => $handler->ui_name(), '@id' => $id)), 'analyze-theme-field') . ': ' . $this->formatThemes($handler->themeFunctions());
$funcs[] = $this->optionLink(t('Field @field (ID: @id)', array('@field' => $handler->uiName(), '@id' => $id)), 'analyze-theme-field') . ': ' . $this->formatThemes($handler->themeFunctions());
}
}
}
@ -2696,8 +2696,8 @@ abstract class DisplayPluginBase extends PluginBase {
public function isIdentifierUnique($id, $identifier) {
foreach (View::viewsObjectTypes() as $type => $info) {
foreach ($this->getHandlers($type) as $key => $handler) {
if ($handler->can_expose() && $handler->is_exposed()) {
if ($handler->is_a_group()) {
if ($handler->canExpose() && $handler->isExposed()) {
if ($handler->isAGroup()) {
if ($id != $key && $identifier == $handler->options['group_info']['identifier']) {
return FALSE;
}
@ -2822,7 +2822,7 @@ abstract class DisplayPluginBase extends PluginBase {
$handler = views_get_handler($info['table'], $info['field'], $handler_type, $override);
if ($handler) {
$handler->init($this->view, $info);
$output .= $indent . '/* ' . $types[$type]['stitle'] . ': ' . $handler->ui_name() . " */\n";
$output .= $indent . '/* ' . $types[$type]['stitle'] . ': ' . $handler->uiName() . " */\n";
$output .= $handler->exportOptions($indent, $prefix . "['$option']['$id']");
}

View File

@ -37,7 +37,7 @@ abstract class ExposedFormPluginBase extends PluginBase {
* @param $display
* The display handler.
*/
function init(&$view, &$display, $options = array()) {
public function init(&$view, &$display, $options = array()) {
$this->view = &$view;
$this->display = &$display;
@ -182,14 +182,14 @@ abstract class ExposedFormPluginBase extends PluginBase {
if (isset($view->sort[$sort_by])) {
$view->query->orderby = array();
foreach ($view->sort as $key => $sort) {
if (!$sort->is_exposed()) {
if (!$sort->isExposed()) {
$sort->query();
}
elseif ($key == $sort_by) {
if (isset($exposed_data['sort_order']) && in_array($exposed_data['sort_order'], array('ASC', 'DESC'))) {
$sort->options['order'] = $exposed_data['sort_order'];
}
$sort->set_relationship();
$sort->setRelationship();
$sort->query();
}
}
@ -203,7 +203,7 @@ abstract class ExposedFormPluginBase extends PluginBase {
function pre_execute() { }
function post_execute() { }
public function postExecute() { }
function exposed_form_alter(&$form, &$form_state) {
if (!empty($this->options['reset_button'])) {
@ -217,7 +217,7 @@ abstract class ExposedFormPluginBase extends PluginBase {
// Check if there is exposed sorts for this view
$exposed_sorts = array();
foreach ($this->view->sort as $id => $handler) {
if ($handler->can_expose() && $handler->is_exposed()) {
if ($handler->canExpose() && $handler->isExposed()) {
$exposed_sorts[$id] = check_plain($handler->options['expose']['label']);
}
}

View File

@ -56,7 +56,7 @@ class InputRequired extends ExposedFormPluginBase {
$view = $this->view;
if (is_array($view->filter) && count($view->filter)) {
foreach ($view->filter as $filter_id => $filter) {
if ($filter->is_exposed()) {
if ($filter->isExposed()) {
$identifier = $filter->options['expose']['identifier'];
if (isset($view->exposed_input[$identifier])) {
$cache = TRUE;

View File

@ -38,7 +38,7 @@ class Boolean extends FieldPluginBase {
return $options;
}
function init(&$view, &$options) {
public function init(&$view, &$options) {
parent::init($view, $options);
$default_formats = array(

View File

@ -20,11 +20,11 @@ use Drupal\Core\Annotation\Plugin;
*/
class Broken extends FieldPluginBase {
function ui_name($short = FALSE) {
public function uiName($short = FALSE) {
return t('Broken/missing handler');
}
function ensure_my_table() { /* No table to ensure! */ }
public function ensureMyTable() { /* No table to ensure! */ }
public function query($group_by = FALSE) { /* No query to run */ }
public function buildOptionsForm(&$form, &$form_state) {
$form['markup'] = array(
@ -35,6 +35,6 @@ class Broken extends FieldPluginBase {
/**
* Determine if the handler is considered 'broken'
*/
function broken() { return TRUE; }
public function broken() { return TRUE; }
}

View File

@ -96,7 +96,7 @@ abstract class FieldPluginBase extends HandlerBase {
* Called to add the field to a query.
*/
public function query() {
$this->ensure_my_table();
$this->ensureMyTable();
// Add the field.
$params = $this->options['group_type'] != 'group' ? array('function' => $this->options['group_type']) : array();
$this->field_alias = $this->query->add_field($this->table_alias, $this->real_field, NULL, $params);
@ -183,7 +183,7 @@ abstract class FieldPluginBase extends HandlerBase {
/**
* Get this field's label.
*/
function label() {
public function label() {
if (!isset($this->options['label'])) {
return '';
}
@ -851,7 +851,7 @@ abstract class FieldPluginBase extends HandlerBase {
// Get a list of the available fields and arguments for token replacement.
$options = array();
foreach ($this->view->display_handler->getHandlers('field') as $field => $handler) {
$options[t('Fields')]["[$field]"] = $handler->ui_name();
$options[t('Fields')]["[$field]"] = $handler->uiName();
// We only use fields up to (and including) this one.
if ($field == $this->options['id']) {
break;
@ -859,8 +859,8 @@ abstract class FieldPluginBase extends HandlerBase {
}
$count = 0; // This lets us prepare the key as we want it printed.
foreach ($this->view->display_handler->getHandlers('argument') as $arg => $handler) {
$options[t('Arguments')]['%' . ++$count] = t('@argument title', array('@argument' => $handler->ui_name()));
$options[t('Arguments')]['!' . $count] = t('@argument input', array('@argument' => $handler->ui_name()));
$options[t('Arguments')]['%' . ++$count] = t('@argument title', array('@argument' => $handler->uiName()));
$options[t('Arguments')]['!' . $count] = t('@argument input', array('@argument' => $handler->uiName()));
}
$this->document_self_tokens($options[t('Fields')]);
@ -1080,7 +1080,7 @@ If you would like to have the characters \'[\' and \']\' please use the html ent
/**
* Provide extra data to the administration form
*/
function admin_summary() {
public function adminSummary() {
return $this->label();
}
@ -1103,7 +1103,7 @@ If you would like to have the characters \'[\' and \']\' please use the html ent
*/
function render($values) {
$value = $this->get_value($values);
return $this->sanitize_value($value);
return $this->sanitizeValue($value);
}
/**
@ -1332,7 +1332,7 @@ If you would like to have the characters \'[\' and \']\' please use the html ent
$path = strip_tags(decode_entities(strtr($path, $tokens)));
if (!empty($alter['path_case']) && $alter['path_case'] != 'none') {
$path = $this->case_transform($path, $this->options['alter']['path_case']);
$path = $this->caseTransform($path, $this->options['alter']['path_case']);
}
if (!empty($alter['replace_spaces'])) {
@ -1625,8 +1625,8 @@ If you would like to have the characters \'[\' and \']\' please use the html ent
return $themes;
}
function ui_name($short = FALSE) {
return $this->get_field(parent::ui_name($short));
public function uiName($short = FALSE) {
return $this->getField(parent::uiName($short));
}
}

View File

@ -151,9 +151,9 @@ class Numeric extends FieldPluginBase {
$value = format_plural($value, $this->options['format_plural_singular'], $this->options['format_plural_plural']);
}
return $this->sanitize_value($this->options['prefix'], 'xss')
. $this->sanitize_value($value)
. $this->sanitize_value($this->options['suffix'], 'xss');
return $this->sanitizeValue($this->options['prefix'], 'xss')
. $this->sanitizeValue($value)
. $this->sanitizeValue($this->options['suffix'], 'xss');
}
}

View File

@ -78,7 +78,7 @@ class PrerenderList extends FieldPluginBase {
function render_items($items) {
if (!empty($items)) {
if ($this->options['type'] == 'separator') {
return implode($this->sanitize_value($this->options['separator'], 'xss_admin'), $items);
return implode($this->sanitizeValue($this->options['separator'], 'xss_admin'), $items);
}
else {
return theme('item_list',

View File

@ -43,10 +43,10 @@ class Url extends FieldPluginBase {
function render($values) {
$value = $this->get_value($values);
if (!empty($this->options['display_as_link'])) {
return l($this->sanitize_value($value), $value, array('html' => TRUE));
return l($this->sanitizeValue($value), $value, array('html' => TRUE));
}
else {
return $this->sanitize_value($value, 'url');
return $this->sanitizeValue($value, 'url');
}
}

View File

@ -23,7 +23,7 @@ class Xss extends FieldPluginBase {
function render($values) {
$value = $this->get_value($values);
return $this->sanitize_value($value, 'xss');
return $this->sanitizeValue($value, 'xss');
}
}

View File

@ -137,8 +137,8 @@ class BooleanOperator extends FilterPluginBase {
}
}
function admin_summary() {
if ($this->is_a_group()) {
public function adminSummary() {
if ($this->isAGroup()) {
return t('grouped');
}
if (!empty($this->options['exposed'])) {
@ -154,15 +154,15 @@ class BooleanOperator extends FilterPluginBase {
return $this->value_options[!empty($this->value)];
}
function expose_options() {
parent::expose_options();
public function defaultExposeOptions() {
parent::defaultExposeOptions();
$this->options['expose']['operator_id'] = '';
$this->options['expose']['label'] = $this->value_value;
$this->options['expose']['required'] = TRUE;
}
public function query() {
$this->ensure_my_table();
$this->ensureMyTable();
$field = "$this->table_alias.$this->real_field";
if (empty($this->value)) {

View File

@ -27,7 +27,7 @@ use Drupal\Core\Annotation\Plugin;
class BooleanOperatorString extends BooleanOperator {
public function query() {
$this->ensure_my_table();
$this->ensureMyTable();
$where = "$this->table_alias.$this->real_field ";
if (empty($this->value)) {

View File

@ -20,11 +20,11 @@ use Drupal\Core\Annotation\Plugin;
*/
class Broken extends FilterPluginBase {
function ui_name($short = FALSE) {
public function uiName($short = FALSE) {
return t('Broken/missing handler');
}
function ensure_my_table() { /* No table to ensure! */ }
public function ensureMyTable() { /* No table to ensure! */ }
public function query($group_by = FALSE) { /* No query to run */ }
public function buildOptionsForm(&$form, &$form_state) {
$form['markup'] = array(
@ -35,6 +35,6 @@ class Broken extends FilterPluginBase {
/**
* Determine if the handler is considered 'broken'
*/
function broken() { return TRUE; }
public function broken() { return TRUE; }
}

View File

@ -40,7 +40,7 @@ class Combine extends String {
if ($this->view->style_plugin->usesFields()) {
$options = array();
foreach ($this->view->display_handler->getHandlers('field') as $name => $field) {
$options[$name] = $field->ui_name(TRUE);
$options[$name] = $field->uiName(TRUE);
}
if ($options) {
$form['fields'] = array(
@ -65,7 +65,7 @@ class Combine extends String {
foreach ($this->options['fields'] as $id) {
$field = $this->view->field[$id];
// Always add the table of the selected fields to be sure a table alias exists.
$field->ensure_my_table();
$field->ensureMyTable();
if (!empty($field->field_alias) && !empty($field->field_alias)) {
$fields[] = "$field->table_alias.$field->real_field";
}

View File

@ -58,7 +58,7 @@ class Date extends Numeric {
$this->validateValidTime($form['value'], $form_state['values']['options']['operator'], $form_state['values']['options']['value']);
}
function exposed_validate(&$form, &$form_state) {
public function validateExposed(&$form, &$form_state) {
if (empty($this->options['exposed'])) {
return;
}
@ -132,14 +132,14 @@ class Date extends Numeric {
}
function accept_exposed_input($input) {
public function acceptExposedInput($input) {
if (empty($this->options['exposed'])) {
return TRUE;
}
// Store this because it will get overwritten.
$type = $this->value['type'];
$rc = parent::accept_exposed_input($input);
$rc = parent::acceptExposedInput($input);
// Don't filter if value(s) are empty.
$operators = $this->operators();

View File

@ -78,7 +78,7 @@ abstract class FilterPluginBase extends HandlerBase {
* This likely has to be overridden by filters which are more complex
* than simple operator/value.
*/
function init(&$view, &$options) {
public function init(&$view, &$options) {
parent::init($view, $options);
$this->operator = $this->options['operator'];
@ -90,7 +90,7 @@ abstract class FilterPluginBase extends HandlerBase {
$this->options['expose']['operator_id'] = $options['expose']['operator'];
}
if ($this->multiple_exposed_input()) {
if ($this->multipleExposedInput()) {
$this->group_info = array_filter($options['group_info']['default_group_multiple']);
$this->options['expose']['multiple'] = TRUE;
}
@ -158,28 +158,28 @@ abstract class FilterPluginBase extends HandlerBase {
/**
* Display the filter on the administrative summary
*/
function admin_summary() {
public function adminSummary() {
return check_plain((string) $this->operator) . ' ' . check_plain((string) $this->value);
}
/**
* Determine if a filter can be exposed.
*/
function can_expose() { return TRUE; }
public function canExpose() { return TRUE; }
/**
* Determine if a filter can be converted into a group.
* Only exposed filters with operators available can be converted into groups.
*/
function can_build_group() {
return $this->is_exposed() && (count($this->operator_options()) > 0);
return $this->isExposed() && (count($this->operator_options()) > 0);
}
/**
* Returns TRUE if the exposed filter works like a grouped filter.
*/
function is_a_group() {
return $this->is_exposed() && !empty($this->options['is_grouped']);
public function isAGroup() {
return $this->isExposed() && !empty($this->options['is_grouped']);
}
/**
@ -190,8 +190,8 @@ abstract class FilterPluginBase extends HandlerBase {
*/
public function buildOptionsForm(&$form, &$form_state) {
parent::buildOptionsForm($form, $form_state);
if ($this->can_expose()) {
$this->show_expose_button($form, $form_state);
if ($this->canExpose()) {
$this->showExposeButton($form, $form_state);
}
if ($this->can_build_group()) {
$this->show_build_group_button($form, $form_state);
@ -199,7 +199,7 @@ abstract class FilterPluginBase extends HandlerBase {
$form['clear_markup_start'] = array(
'#markup' => '<div class="clearfix">',
);
if ($this->is_a_group()) {
if ($this->isAGroup()) {
if ($this->can_build_group()) {
$form['clear_markup_start'] = array(
'#markup' => '<div class="clearfix">',
@ -219,9 +219,9 @@ abstract class FilterPluginBase extends HandlerBase {
$form['clear_markup_end'] = array(
'#markup' => '</div>',
);
if ($this->can_expose()) {
// Add the subform from expose_form().
$this->show_expose_form($form, $form_state);
if ($this->canExpose()) {
// Add the subform from buildExposeForm().
$this->showExposeForm($form, $form_state);
}
}
}
@ -232,10 +232,10 @@ abstract class FilterPluginBase extends HandlerBase {
public function validateOptionsForm(&$form, &$form_state) {
$this->operator_validate($form, $form_state);
$this->value_validate($form, $form_state);
if (!empty($this->options['exposed']) && !$this->is_a_group()) {
$this->expose_validate($form, $form_state);
if (!empty($this->options['exposed']) && !$this->isAGroup()) {
$this->validateExposeForm($form, $form_state);
}
if ($this->is_a_group()) {
if ($this->isAGroup()) {
$this->build_group_validate($form, $form_state);
}
}
@ -246,14 +246,14 @@ abstract class FilterPluginBase extends HandlerBase {
public function submitOptionsForm(&$form, &$form_state) {
unset($form_state['values']['expose_button']); // don't store this.
unset($form_state['values']['group_button']); // don't store this.
if (!$this->is_a_group()) {
if (!$this->isAGroup()) {
$this->operator_submit($form, $form_state);
$this->value_submit($form, $form_state);
}
if (!empty($this->options['exposed'])) {
$this->expose_submit($form, $form_state);
$this->submitExposeForm($form, $form_state);
}
if ($this->is_a_group()) {
if ($this->isAGroup()) {
$this->build_group_submit($form, $form_state);
}
}
@ -411,7 +411,7 @@ abstract class FilterPluginBase extends HandlerBase {
/**
* Shortcut to display the expose/hide button.
*/
function show_expose_button(&$form, &$form_state) {
public function showExposeButton(&$form, &$form_state) {
$form['expose_button'] = array(
'#prefix' => '<div class="views-expose clearfix">',
'#suffix' => '</div>',
@ -462,7 +462,7 @@ abstract class FilterPluginBase extends HandlerBase {
*
* @see buildOptionsForm()
*/
function expose_form(&$form, &$form_state) {
public function buildExposeForm(&$form, &$form_state) {
$form['#theme'] = 'views_ui_expose_filter_form';
// #flatten will move everything from $form['expose'][$key] to $form[$key]
// prior to rendering. That's why the pre_render for it needs to run first,
@ -574,7 +574,7 @@ abstract class FilterPluginBase extends HandlerBase {
/**
* Validate the options form.
*/
function expose_validate($form, &$form_state) {
public function validateExposeForm($form, &$form_state) {
if (empty($form_state['values']['options']['expose']['identifier'])) {
form_error($form['expose']['identifier'], t('The identifier is required if the filter is exposed.'));
}
@ -668,7 +668,7 @@ abstract class FilterPluginBase extends HandlerBase {
/**
* Provide default options for exposed filters.
*/
function expose_options() {
public function defaultExposeOptions() {
$this->options['expose'] = array(
'use_operator' => FALSE,
'operator' => $this->options['id'] . '_op',
@ -704,7 +704,7 @@ abstract class FilterPluginBase extends HandlerBase {
* single filter.
*/
function group_form(&$form, &$form_state) {
if (!empty($this->options['group_info']['optional']) && !$this->multiple_exposed_input()) {
if (!empty($this->options['group_info']['optional']) && !$this->multipleExposedInput()) {
$old_any = $this->options['group_info']['widget'] == 'select' ? '<Any>' : '&lt;Any&gt;';
$any_label = variable_get('views_exposed_filter_any_label', 'new_any') == 'old_any' ? $old_any : t('- Any -');
@ -749,7 +749,7 @@ abstract class FilterPluginBase extends HandlerBase {
*
* You can override this if it doesn't do what you expect.
*/
function exposed_form(&$form, &$form_state) {
public function buildExposedForm(&$form, &$form_state) {
if (empty($this->options['exposed'])) {
return;
}
@ -1134,12 +1134,12 @@ abstract class FilterPluginBase extends HandlerBase {
* - value: The $form key of the value. Set to NULL if no value.
* - label: The label to use for this piece.
*/
function exposed_info() {
public function exposedInfo() {
if (empty($this->options['exposed'])) {
return;
}
if ($this->is_a_group()) {
if ($this->isAGroup()) {
return array(
'value' => $this->options['group_info']['identifier'],
'label' => $this->options['group_info']['label'],
@ -1167,7 +1167,7 @@ abstract class FilterPluginBase extends HandlerBase {
* choosed in the checkboxes.
*/
function convert_exposed_input(&$input, $selected_group_id = NULL) {
if ($this->is_a_group()) {
if ($this->isAGroup()) {
// If it is already defined the selected group, use it. Only valid
// when the filter uses checkboxes for widget.
if (!empty($selected_group_id)) {
@ -1207,7 +1207,7 @@ abstract class FilterPluginBase extends HandlerBase {
*/
function group_multiple_exposed_input(&$input) {
if (!empty($input[$this->options['group_info']['identifier']])) {
return array_filter($input[$this->options['group_info']['identifier']]);
return array_filter($input[$this->options['group_info']['identifier']]);
}
return array();
}
@ -1216,17 +1216,17 @@ abstract class FilterPluginBase extends HandlerBase {
* Returns TRUE if users can select multiple groups items of a
* grouped exposed filter.
*/
function multiple_exposed_input() {
return $this->is_a_group() && !empty($this->options['group_info']['multiple']);
public function multipleExposedInput() {
return $this->isAGroup() && !empty($this->options['group_info']['multiple']);
}
/**
* If set to remember exposed input in the session, store it there.
* This function is similar to store_exposed_input but modified to
* This function is similar to storeExposedInput but modified to
* work properly when the filter is a group.
*/
function store_group_input($input, $status) {
if (!$this->is_a_group() || empty($this->options['group_info']['identifier'])) {
if (!$this->isAGroup() || empty($this->options['group_info']['identifier'])) {
return TRUE;
}
@ -1263,7 +1263,7 @@ abstract class FilterPluginBase extends HandlerBase {
* Check to see if input from the exposed filters should change
* the behavior of this filter.
*/
function accept_exposed_input($input) {
public function acceptExposedInput($input) {
if (empty($this->options['exposed'])) {
return TRUE;
}
@ -1308,7 +1308,7 @@ abstract class FilterPluginBase extends HandlerBase {
return TRUE;
}
function store_exposed_input($input, $status) {
public function storeExposedInput($input, $status) {
if (empty($this->options['exposed']) || empty($this->options['expose']['identifier'])) {
return TRUE;
}
@ -1368,7 +1368,7 @@ abstract class FilterPluginBase extends HandlerBase {
* and $this->value respectively.
*/
public function query() {
$this->ensure_my_table();
$this->ensureMyTable();
$this->query->add_where($this->options['group'], "$this->table_alias.$this->real_field", $this->value, $this->operator);
}

View File

@ -21,8 +21,8 @@ use Drupal\Core\Annotation\Plugin;
class GroupByNumeric extends Numeric {
public function query() {
$this->ensure_my_table();
$field = $this->get_field();
$this->ensureMyTable();
$field = $this->getField();
$info = $this->operators();
if (!empty($info[$this->operator]['method'])) {
@ -57,8 +57,8 @@ class GroupByNumeric extends Numeric {
$this->query->add_having_expression($this->options['group'], "$field $operator");
}
function ui_name($short = FALSE) {
return $this->get_field(parent::ui_name($short));
public function uiName($short = FALSE) {
return $this->getField(parent::uiName($short));
}
function can_group() { return FALSE; }

View File

@ -69,13 +69,13 @@ class InOperator extends FilterPluginBase {
return $this->value_options;
}
function expose_options() {
parent::expose_options();
public function defaultExposeOptions() {
parent::defaultExposeOptions();
$this->options['expose']['reduce'] = FALSE;
}
function expose_form(&$form, &$form_state) {
parent::expose_form($form, $form_state);
public function buildExposeForm(&$form, &$form_state) {
parent::buildExposeForm($form, $form_state);
$form['expose']['reduce'] = array(
'#type' => 'checkbox',
'#title' => t('Limit list to selected items'),
@ -271,7 +271,7 @@ class InOperator extends FilterPluginBase {
return $options;
}
function accept_exposed_input($input) {
public function acceptExposedInput($input) {
// A very special override because the All state for this type of
// filter could have a default:
if (empty($this->options['exposed'])) {
@ -287,7 +287,7 @@ class InOperator extends FilterPluginBase {
}
}
return parent::accept_exposed_input($input);
return parent::acceptExposedInput($input);
}
function value_submit($form, &$form_state) {
@ -303,8 +303,8 @@ class InOperator extends FilterPluginBase {
$form_state['values']['options']['value'] = $form['value']['#value'];
}
function admin_summary() {
if ($this->is_a_group()) {
public function adminSummary() {
if ($this->isAGroup()) {
return t('grouped');
}
if (!empty($this->options['exposed'])) {
@ -376,7 +376,7 @@ class InOperator extends FilterPluginBase {
if (empty($this->value)) {
return;
}
$this->ensure_my_table();
$this->ensureMyTable();
// We use array_values() because the checkboxes keep keys and that can cause
// array addition problems.
@ -384,7 +384,7 @@ class InOperator extends FilterPluginBase {
}
function op_empty() {
$this->ensure_my_table();
$this->ensureMyTable();
if ($this->operator == 'empty') {
$operator = "IS NULL";
}
@ -406,7 +406,7 @@ class InOperator extends FilterPluginBase {
}
if (!in_array($this->operator, $this->operator_values(1))) {
$errors[] = t('The operator is invalid on filter: @filter.', array('@filter' => $this->ui_name(TRUE)));
$errors[] = t('The operator is invalid on filter: @filter.', array('@filter' => $this->uiName(TRUE)));
}
if (is_array($this->value)) {
if (!isset($this->value_options)) {
@ -429,11 +429,11 @@ class InOperator extends FilterPluginBase {
}
// Choose different kind of ouput for 0, a single and multiple values.
if (count($this->value) == 0) {
$errors[] = t('No valid values found on filter: @filter.', array('@filter' => $this->ui_name(TRUE)));
$errors[] = t('No valid values found on filter: @filter.', array('@filter' => $this->uiName(TRUE)));
}
}
elseif (!empty($this->value) && ($this->operator == 'in' || $this->operator == 'not in')) {
$errors[] = t('The value @value is not an array for @operator on filter: @filter', array('@value' => views_var_export($this->value), '@operator' => $this->operator, '@filter' => $this->ui_name(TRUE)));
$errors[] = t('The value @value is not an array for @operator on filter: @filter', array('@value' => views_var_export($this->value), '@operator' => $this->operator, '@filter' => $this->uiName(TRUE)));
}
return $errors;
}

View File

@ -15,7 +15,7 @@ use Drupal\Core\Annotation\Plugin;
* such as terms (many terms per node) or roles (many roles per user).
*
* The construct method needs to be overridden to provide a list of options;
* alternately, the value_form and admin_summary methods need to be overriden
* alternately, the value_form and adminSummary methods need to be overriden
* to provide something that isn't just a select list.
*
* @ingroup views_filter_handlers
@ -33,7 +33,7 @@ class ManyToOne extends InOperator {
*/
var $helper = NULL;
function init(&$view, &$options) {
public function init(&$view, &$options) {
parent::init($view, $options);
$this->helper = new ManyToOneHelper($this);
}
@ -113,17 +113,17 @@ class ManyToOne extends InOperator {
}
/**
* Override ensure_my_table so we can control how this joins in.
* Override ensureMyTable so we can control how this joins in.
* The operator actually has influence over joining.
*/
function ensure_my_table() {
public function ensureMyTable() {
// Defer to helper if the operator specifies it.
$info = $this->operators();
if (isset($info[$this->operator]['ensure_my_table']) && $info[$this->operator]['ensure_my_table'] == 'helper') {
return $this->helper->ensure_my_table();
return $this->helper->ensureMyTable();
}
return parent::ensure_my_table();
return parent::ensureMyTable();
}
function op_helper() {

View File

@ -244,7 +244,7 @@ class Numeric extends FilterPluginBase {
}
public function query() {
$this->ensure_my_table();
$this->ensureMyTable();
$field = "$this->table_alias.$this->real_field";
$info = $this->operators();
@ -281,8 +281,8 @@ class Numeric extends FilterPluginBase {
$this->query->add_where($this->options['group'], $field, $this->value, 'RLIKE');
}
function admin_summary() {
if ($this->is_a_group()) {
public function adminSummary() {
if ($this->isAGroup()) {
return t('grouped');
}
if (!empty($this->options['exposed'])) {
@ -303,7 +303,7 @@ class Numeric extends FilterPluginBase {
/**
* Do some minor translation of the exposed input
*/
function accept_exposed_input($input) {
public function acceptExposedInput($input) {
if (empty($this->options['exposed'])) {
return TRUE;
}
@ -319,7 +319,7 @@ class Numeric extends FilterPluginBase {
}
}
$rc = parent::accept_exposed_input($input);
$rc = parent::acceptExposedInput($input);
if (empty($this->options['expose']['required'])) {
// We have to do some of our own checking for non-required filters.

View File

@ -157,8 +157,8 @@ class String extends FilterPluginBase {
return $options;
}
function admin_summary() {
if ($this->is_a_group()) {
public function adminSummary() {
if ($this->isAGroup()) {
return t('grouped');
}
if (!empty($this->options['exposed'])) {
@ -253,7 +253,7 @@ class String extends FilterPluginBase {
* and $this->value respectively.
*/
public function query() {
$this->ensure_my_table();
$this->ensureMyTable();
$field = "$this->table_alias.$this->real_field";
$info = $this->operators();

View File

@ -33,7 +33,7 @@ abstract class LocalizationPluginBase extends PluginBase {
* @param $view
* The view object.
*/
function init(&$view) {
public function init(&$view) {
$this->view = &$view;
}

View File

@ -24,7 +24,7 @@ use Drupal\Core\Annotation\Translation;
*/
class None extends PagerPluginBase {
function init(&$view, &$display, $options = array()) {
public function init(&$view, &$display, $options = array()) {
parent::init($view, $display, $options);
// If the pager is set to none, then it should show all items.
@ -74,7 +74,7 @@ class None extends PagerPluginBase {
// If we are displaying all items, never count. But we can update the count in post_execute.
}
function post_execute(&$result) {
public function postExecute(&$result) {
$this->total_items = count($result);
}

View File

@ -39,7 +39,7 @@ abstract class PagerPluginBase extends PluginBase {
* @param $display
* The display handler.
*/
function init(&$view, &$display, $options = array()) {
public function init(&$view, &$display, $options = array()) {
$this->view = &$view;
$this->display = &$display;
@ -194,7 +194,7 @@ abstract class PagerPluginBase extends PluginBase {
/**
* Perform any needed actions just after the query executing.
*/
function post_execute(&$result) { }
public function postExecute(&$result) { }
/**
* Perform any needed actions just before rendering.

View File

@ -24,7 +24,7 @@ abstract class QueryPluginBase extends PluginBase implements QueryInterface {
/**
* Constructor; Create the basic query object and fill with default values.
*/
function init($base_table, $base_field, $options) {
public function init($base_table, $base_field, $options) {
$this->base_table = $base_table;
$this->base_field = $base_field;
$this->unpackOptions($this->options, $options);

View File

@ -113,7 +113,7 @@ class Sql extends QueryPluginBase {
/**
* Constructor; Create the basic query object and fill with default values.
*/
function init($base_table = 'node', $base_field = 'nid', $options) {
public function init($base_table = 'node', $base_field = 'nid', $options) {
parent::init($base_table, $base_field, $options);
$this->base_table = $base_table; // Predefine these above, for clarity.
$this->base_field = $base_field;
@ -1502,7 +1502,7 @@ class Sql extends QueryPluginBase {
$view->result[] = $item;
}
$view->pager->post_execute($view->result);
$view->pager->postExecute($view->result);
if ($view->pager->use_count_query() || !empty($view->get_total_rows)) {
$view->total_rows = $view->pager->get_total_items();
}

View File

@ -20,11 +20,11 @@ use Drupal\Core\Annotation\Plugin;
*/
class Broken extends RelationshipPluginBase {
function ui_name($short = FALSE) {
public function uiName($short = FALSE) {
return t('Broken/missing handler');
}
function ensure_my_table() { /* No table to ensure! */ }
public function ensureMyTable() { /* No table to ensure! */ }
public function query() { /* No query to run */ }
public function buildOptionsForm(&$form, &$form_state) {
$form['markup'] = array(
@ -35,6 +35,6 @@ class Broken extends RelationshipPluginBase {
/**
* Determine if the handler is considered 'broken'
*/
function broken() { return TRUE; }
public function broken() { return TRUE; }
}

View File

@ -343,7 +343,7 @@ class GroupwiseMax extends RelationshipPluginBase {
$table_data = views_fetch_data($this->definition['base']);
$base_field = empty($this->definition['base field']) ? $table_data['table']['base']['field'] : $this->definition['base field'];
$this->ensure_my_table();
$this->ensureMyTable();
$def = $this->definition;
$def['table'] = $this->definition['base'];

View File

@ -47,7 +47,7 @@ abstract class RelationshipPluginBase extends HandlerBase {
* Init handler to let relationships live on tables other than
* the table they operate on.
*/
function init(&$view, &$options) {
public function init(&$view, &$options) {
parent::init($view, $options);
if (isset($this->definition['relationship table'])) {
$this->table = $this->definition['relationship table'];
@ -69,6 +69,7 @@ abstract class RelationshipPluginBase extends HandlerBase {
return $this->options['label'];
}
protected function defineOptions() {
$options = parent::defineOptions();
@ -117,7 +118,7 @@ abstract class RelationshipPluginBase extends HandlerBase {
$table_data = views_fetch_data($this->definition['base']);
$base_field = empty($this->definition['base field']) ? $table_data['table']['base']['field'] : $this->definition['base field'];
$this->ensure_my_table();
$this->ensureMyTable();
$def = $this->definition;
$def['table'] = $this->definition['base'];
@ -160,7 +161,7 @@ abstract class RelationshipPluginBase extends HandlerBase {
/**
* You can't groupby a relationship.
*/
function use_group_by() {
public function usesGroupBy() {
return FALSE;
}

View File

@ -41,7 +41,7 @@ abstract class RowPluginBase extends PluginBase {
/**
* Initialize the row plugin.
*/
function init(&$view, &$display, $options = NULL) {
public function init(&$view, &$display, $options = NULL) {
$this->view = &$view;
$this->display = &$display;

View File

@ -20,11 +20,11 @@ use Drupal\Core\Annotation\Plugin;
*/
class Broken extends SortPluginBase {
function ui_name($short = FALSE) {
public function uiName($short = FALSE) {
return t('Broken/missing handler');
}
function ensure_my_table() { /* No table to ensure! */ }
public function ensureMyTable() { /* No table to ensure! */ }
public function query($group_by = FALSE) { /* No query to run */ }
public function buildOptionsForm(&$form, &$form_state) {
$form['markup'] = array(
@ -35,6 +35,6 @@ class Broken extends SortPluginBase {
/**
* Determine if the handler is considered 'broken'
*/
function broken() { return TRUE; }
public function broken() { return TRUE; }
}

View File

@ -52,7 +52,7 @@ class Date extends SortPluginBase {
* Called to add the sort to a query.
*/
public function query() {
$this->ensure_my_table();
$this->ensureMyTable();
switch ($this->options['granularity']) {
case 'second':
default:

View File

@ -18,7 +18,7 @@ use Drupal\Core\Annotation\Plugin;
*/
class GroupByNumeric extends SortPluginBase {
function init(&$view, &$options) {
public function init(&$view, &$options) {
parent::init($view, $options);
// Initialize the original handler.
@ -30,7 +30,7 @@ class GroupByNumeric extends SortPluginBase {
* Called to add the field to a query.
*/
public function query() {
$this->ensure_my_table();
$this->ensureMyTable();
$params = array(
'function' => $this->options['group_type'],
@ -39,8 +39,8 @@ class GroupByNumeric extends SortPluginBase {
$this->query->add_orderby($this->table_alias, $this->real_field, $this->options['order'], NULL, $params);
}
function ui_name($short = FALSE) {
return $this->get_field(parent::ui_name($short));
public function uiName($short = FALSE) {
return $this->getField(parent::uiName($short));
}
}

View File

@ -42,7 +42,7 @@ class MenuHierarchy extends SortPluginBase {
}
public function query() {
$this->ensure_my_table();
$this->ensureMyTable();
$max_depth = isset($this->definition['max depth']) ? $this->definition['max depth'] : MENU_MAX_DEPTH;
for ($i = 1; $i <= $max_depth; ++$i) {
if ($this->options['sort_within_level']) {

View File

@ -26,13 +26,13 @@ abstract class SortPluginBase extends HandlerBase {
/**
* Determine if a sort can be exposed.
*/
function can_expose() { return TRUE; }
public function canExpose() { return TRUE; }
/**
* Called to add the sort to a query.
*/
public function query() {
$this->ensure_my_table();
$this->ensureMyTable();
// Add the field.
$this->query->add_orderby($this->table_alias, $this->real_field, $this->options['order']);
}
@ -53,7 +53,7 @@ abstract class SortPluginBase extends HandlerBase {
/**
* Display whether or not the sort order is ascending or descending
*/
function admin_summary() {
public function adminSummary() {
if (!empty($this->options['exposed'])) {
return t('Exposed');
}
@ -75,21 +75,21 @@ abstract class SortPluginBase extends HandlerBase {
*/
public function buildOptionsForm(&$form, &$form_state) {
parent::buildOptionsForm($form, $form_state);
if ($this->can_expose()) {
$this->show_expose_button($form, $form_state);
if ($this->canExpose()) {
$this->showExposeButton($form, $form_state);
}
$form['op_val_start'] = array('#value' => '<div class="clearfix">');
$this->show_sort_form($form, $form_state);
$form['op_val_end'] = array('#value' => '</div>');
if ($this->can_expose()) {
$this->show_expose_form($form, $form_state);
if ($this->canExpose()) {
$this->showExposeForm($form, $form_state);
}
}
/**
* Shortcut to display the expose/hide button.
*/
function show_expose_button(&$form, &$form_state) {
public function showExposeButton(&$form, &$form_state) {
$form['expose_button'] = array(
'#prefix' => '<div class="views-expose clearfix">',
'#suffix' => '</div>',
@ -141,7 +141,7 @@ abstract class SortPluginBase extends HandlerBase {
public function validateOptionsForm(&$form, &$form_state) {
$this->sort_validate($form, $form_state);
if (!empty($this->options['exposed'])) {
$this->expose_validate($form, $form_state);
$this->validateExposeForm($form, $form_state);
}
}
@ -153,7 +153,7 @@ abstract class SortPluginBase extends HandlerBase {
unset($form_state['values']['expose_button']); // don't store this.
$this->sort_submit($form, $form_state);
if (!empty($this->options['exposed'])) {
$this->expose_submit($form, $form_state);
$this->submitExposeForm($form, $form_state);
}
}
@ -186,7 +186,7 @@ abstract class SortPluginBase extends HandlerBase {
);
}
function expose_form(&$form, &$form_state) {
public function buildExposeForm(&$form, &$form_state) {
// #flatten will move everything from $form['expose'][$key] to $form[$key]
// prior to rendering. That's why the pre_render for it needs to run first,
// so that when the next pre_render (the one for fieldsets) runs, it gets
@ -207,7 +207,7 @@ abstract class SortPluginBase extends HandlerBase {
/**
* Provide default options for exposed sorts.
*/
function expose_options() {
public function defaultExposeOptions() {
$this->options['expose'] = array(
'order' => $this->options['order'],
'label' => $this->definition['title'],

View File

@ -89,7 +89,7 @@ abstract class StylePluginBase extends PluginBase {
* The style options might come externally as the style can be sourced
* from at least two locations. If it's not included, look on the display.
*/
function init(&$view, &$display, $options = NULL) {
public function init(&$view, &$display, $options = NULL) {
$this->view = &$view;
$this->display = &$display;

View File

@ -724,7 +724,7 @@ class View extends ViewStorage {
}
/**
* Run the pre_query() on all active handlers.
* Run the preQuery() on all active handlers.
*/
protected function _preQuery() {
foreach (View::viewsObjectTypes() as $key => $info) {
@ -732,20 +732,20 @@ class View extends ViewStorage {
$position = 0;
foreach ($handlers as $id => $handler) {
$handlers[$id]->position = $position;
$handlers[$id]->pre_query();
$handlers[$id]->preQuery();
$position++;
}
}
}
/**
* Run the post_execute() on all active handlers.
* Run the postExecute() on all active handlers.
*/
protected function _postExecute() {
foreach (View::viewsObjectTypes() as $key => $info) {
$handlers = &$this->$key;
foreach ($handlers as $id => $handler) {
$handlers[$id]->post_execute($this->result);
$handlers[$id]->postExecute($this->result);
}
}
}
@ -804,7 +804,7 @@ class View extends ViewStorage {
continue;
}
$argument->set_relationship();
$argument->setRelationship();
$arg = isset($this->args[$position]) ? $this->args[$position] : NULL;
$argument->position = $position;
@ -1081,27 +1081,27 @@ class View extends ViewStorage {
if (!empty($handlers[$id]) && is_object($handlers[$id])) {
$multiple_exposed_input = array(0 => NULL);
if ($handlers[$id]->multiple_exposed_input()) {
if ($handlers[$id]->multipleExposedInput()) {
$multiple_exposed_input = $handlers[$id]->group_multiple_exposed_input($this->exposed_data);
}
foreach ($multiple_exposed_input as $group_id) {
// Give this handler access to the exposed filter input.
if (!empty($this->exposed_data)) {
$converted = FALSE;
if ($handlers[$id]->is_a_group()) {
if ($handlers[$id]->isAGroup()) {
$converted = $handlers[$id]->convert_exposed_input($this->exposed_data, $group_id);
$handlers[$id]->store_group_input($this->exposed_data, $converted);
if (!$converted) {
continue;
}
}
$rc = $handlers[$id]->accept_exposed_input($this->exposed_data);
$handlers[$id]->store_exposed_input($this->exposed_data, $rc);
$rc = $handlers[$id]->acceptExposedInput($this->exposed_data);
$handlers[$id]->storeExposedInput($this->exposed_data, $rc);
if (!$rc) {
continue;
}
}
$handlers[$id]->set_relationship();
$handlers[$id]->setRelationship();
$handlers[$id]->query($this->display_handler->useGroupBy());
}
}

View File

@ -66,7 +66,7 @@ class Category extends FieldPluginBase {
function render($values) {
$value = $this->get_value($values);
return $this->render_link($this->sanitize_value($value), $values);
return $this->render_link($this->sanitizeValue($value), $values);
}
}

View File

@ -50,7 +50,7 @@ class TitleLink extends FieldPluginBase {
function render($values) {
$value = $this->get_value($values);
return $this->render_link($this->sanitize_value($value), $values);
return $this->render_link($this->sanitizeValue($value), $values);
}
function render_link($data, $values) {

View File

@ -55,7 +55,7 @@ class UserUid extends ArgumentPluginBase {
}
public function query($group_by = FALSE) {
$this->ensure_my_table();
$this->ensureMyTable();
$subselect = db_select('comment', 'c');
$subselect->addField('c', 'cid');

View File

@ -25,7 +25,7 @@ class Comment extends FieldPluginBase {
/**
* Override init function to provide generic option to link to comment.
*/
function init(&$view, &$options) {
public function init(&$view, &$options) {
parent::init($view, $options);
if (!empty($this->options['link_to_comment'])) {
$this->additional_fields['cid'] = 'cid';
@ -79,7 +79,7 @@ class Comment extends FieldPluginBase {
function render($values) {
$value = $this->get_value($values);
return $this->render_link($this->sanitize_value($value), $values);
return $this->render_link($this->sanitizeValue($value), $values);
}
}

View File

@ -21,7 +21,7 @@ use Drupal\Core\Annotation\Plugin;
*/
class LinkApprove extends Link {
function access() {
public function access() {
//needs permission to administer comments in general
return user_access('administer comments');
}

View File

@ -21,7 +21,7 @@ use Drupal\Core\Annotation\Plugin;
*/
class LinkDelete extends Link {
function access() {
public function access() {
//needs permission to administer comments in general
return user_access('administer comments');
}

View File

@ -21,7 +21,7 @@ use Drupal\Core\Annotation\Plugin;
*/
class LinkReply extends Link {
function access() {
public function access() {
//check for permission to reply to comments
return user_access('post comments');
}

View File

@ -25,7 +25,7 @@ class NcsLastCommentName extends FieldPluginBase {
public function query() {
// last_comment_name only contains data if the user is anonymous. So we
// have to join in a specially related user table.
$this->ensure_my_table();
$this->ensureMyTable();
// join 'users' to this table via vid
$join = views_get_join();
$join->construct('users', $this->table_alias, 'last_comment_uid', 'uid');
@ -59,7 +59,7 @@ class NcsLastCommentName extends FieldPluginBase {
));
}
else {
return $this->sanitize_value($this->get_value($values));
return $this->sanitizeValue($this->get_value($values));
}
}

View File

@ -23,7 +23,7 @@ use Drupal\Core\Annotation\Plugin;
class NcsLastUpdated extends Date {
public function query() {
$this->ensure_my_table();
$this->ensureMyTable();
$this->node_table = $this->query->ensure_table('node', $this->relationship);
$this->field_alias = $this->query->add_field(NULL, "GREATEST(" . $this->node_table . ".changed, " . $this->table_alias . ".last_comment_timestamp)", $this->table_alias . '_' . $this->field);
}

View File

@ -49,7 +49,7 @@ class NodeNewComments extends Numeric {
}
public function query() {
$this->ensure_my_table();
$this->ensureMyTable();
$this->add_additional_fields();
$this->field_alias = $this->table . '_' . $this->field;
}

View File

@ -25,7 +25,7 @@ class Username extends FieldPluginBase {
/**
* Override init function to add uid and homepage fields.
*/
function init(&$view, &$data) {
public function init(&$view, &$data) {
parent::init($view, $data);
$this->additional_fields['uid'] = 'uid';
$this->additional_fields['homepage'] = 'homepage';
@ -64,7 +64,7 @@ class Username extends FieldPluginBase {
function render($values) {
$value = $this->get_value($values);
return $this->render_link($this->sanitize_value($value), $values);
return $this->render_link($this->sanitizeValue($value), $values);
}
}

View File

@ -23,7 +23,7 @@ use Drupal\Core\Annotation\Plugin;
class NcsLastUpdated extends Date {
public function query() {
$this->ensure_my_table();
$this->ensureMyTable();
$this->node_table = $this->query->ensure_table('node', $this->relationship);
$field = "GREATEST(" . $this->node_table . ".changed, " . $this->table_alias . ".last_comment_timestamp)";

View File

@ -24,7 +24,7 @@ use Drupal\Core\Annotation\Plugin;
class UserUid extends FilterPluginBase {
public function query() {
$this->ensure_my_table();
$this->ensureMyTable();
$subselect = db_select('comment', 'c');
$subselect->addField('c', 'cid');

View File

@ -24,7 +24,7 @@ use Drupal\Core\Annotation\Plugin;
class NcsLastCommentName extends SortPluginBase {
public function query() {
$this->ensure_my_table();
$this->ensureMyTable();
$join = views_get_join();
$join->construct('users', $this->table_alias, 'last_comment_uid', 'uid');

View File

@ -23,7 +23,7 @@ use Drupal\Core\Annotation\Plugin;
class NcsLastUpdated extends Date {
public function query() {
$this->ensure_my_table();
$this->ensureMyTable();
$this->node_table = $this->query->ensure_table('node', $this->relationship);
$this->field_alias = $this->query->add_orderby(NULL, "GREATEST(" . $this->node_table . ".changed, " . $this->table_alias . ".last_comment_timestamp)", $this->options['order'], $this->table_alias . '_' . $this->field);
}

View File

@ -23,7 +23,7 @@ use Drupal\Core\Annotation\Plugin;
class Thread extends SortPluginBase {
public function query() {
$this->ensure_my_table();
$this->ensureMyTable();
//Read comment_render() in comment.module for an explanation of the
//thinking behind this sort.

View File

@ -32,7 +32,7 @@ class ContactLink extends Link {
// An example of field level access control.
// We must override the access method in the parent class, as that requires
// the 'access user profiles' permission, which the contact form does not.
function access() {
public function access() {
return user_access('access user contact forms');
}

View File

@ -30,7 +30,7 @@ class FieldList extends Numeric {
*/
var $allowed_values = NULL;
function init(&$view, &$options) {
public function init(&$view, &$options) {
parent::init($view, $options);
$field = field_info_field($this->definition['field_name']);
$this->allowed_values = options_allowed_values($field);

View File

@ -30,7 +30,7 @@ class ListString extends String {
*/
var $allowed_values = NULL;
function init(&$view, &$options) {
public function init(&$view, &$options) {
parent::init($view, $options);
$field = field_info_field($this->definition['field_name']);
$this->allowed_values = options_allowed_values($field);
@ -64,11 +64,11 @@ class ListString extends String {
$value = $data->{$this->name_alias};
// If the list element has a human readable name show it,
if (isset($this->allowed_values[$value]) && !empty($this->options['summary']['human'])) {
return $this->case_transform(field_filter_xss($this->allowed_values[$value]), $this->options['case']);
return $this->caseTransform(field_filter_xss($this->allowed_values[$value]), $this->options['case']);
}
// else fallback to the key.
else {
return $this->case_transform(check_plain($value), $this->options['case']);
return $this->caseTransform(check_plain($value), $this->options['case']);
}
}

View File

@ -65,7 +65,7 @@ class Field extends FieldPluginBase {
*/
public $instance;
function init(&$view, &$options) {
public function init(&$view, &$options) {
parent::init($view, $options);
$this->field_info = $field = field_info_field($this->definition['field_name']);
@ -100,7 +100,7 @@ class Field extends FieldPluginBase {
* @return bool
* Return TRUE if the user has access to view this field.
*/
function access() {
public function access() {
$base_table = $this->get_base_table();
return field_access('view', $this->field_info, $this->definition['entity_tables'][$base_table]);
}
@ -174,7 +174,7 @@ class Field extends FieldPluginBase {
// Add additional fields (and the table join itself) if needed.
if ($this->add_field_table($use_groupby)) {
$this->ensure_my_table();
$this->ensureMyTable();
$this->add_additional_fields($fields);
// Filter by langcode, if field translation is enabled.
@ -242,7 +242,7 @@ class Field extends FieldPluginBase {
return;
}
$this->ensure_my_table();
$this->ensureMyTable();
$column = _field_sql_storage_columnname($this->definition['field_name'], $this->options['click_sort_column']);
if (!isset($this->aliases[$column])) {
// Column is not in query; add a sort on it (without adding the column).
@ -529,8 +529,8 @@ class Field extends FieldPluginBase {
/**
* Extend the groupby form with group columns.
*/
function groupby_form(&$form, &$form_state) {
parent::groupby_form($form, $form_state);
public function buildGroupByForm(&$form, &$form_state) {
parent::buildGroupByForm($form, $form_state);
// With "field API" fields, the column target of the grouping function
// and any additional grouping columns must be specified.
$group_columns = array(
@ -557,8 +557,8 @@ class Field extends FieldPluginBase {
);
}
function groupby_form_submit(&$form, &$form_state) {
parent::groupby_form_submit($form, $form_state);
public function submitGroupByForm(&$form, &$form_state) {
parent::submitGroupByForm($form, $form_state);
$item =& $form_state['handler']->options;
// Add settings for "field API" fields.

View File

@ -22,7 +22,7 @@ use Drupal\Core\Annotation\Plugin;
*/
class EntityReverse extends RelationshipPluginBase {
function init(&$view, &$options) {
public function init(&$view, &$options) {
parent::init($view, $options);
$this->field_info = field_info_field($this->definition['field_name']);
@ -32,7 +32,7 @@ class EntityReverse extends RelationshipPluginBase {
* Called to implement a relationship in a query.
*/
public function query() {
$this->ensure_my_table();
$this->ensureMyTable();
// First, relate our base table to the current base table to the
// field, using the base table's id field to the field's column.
$views_data = views_fetch_data($this->table);

View File

@ -25,7 +25,7 @@ class Extension extends FieldPluginBase {
function render($values) {
$value = $this->get_value($values);
if (preg_match('/\.([^\.]+)$/', $value, $match)) {
return $this->sanitize_value($match[1]);
return $this->sanitizeValue($match[1]);
}
}

View File

@ -25,7 +25,7 @@ class File extends FieldPluginBase {
/**
* Constructor to provide additional field to add.
*/
function init(&$view, &$options) {
public function init(&$view, &$options) {
parent::init($view, $options);
if (!empty($options['link_to_file'])) {
$this->additional_fields['uri'] = 'uri';
@ -67,7 +67,7 @@ class File extends FieldPluginBase {
function render($values) {
$value = $this->get_value($values);
return $this->render_link($this->sanitize_value($value), $values);
return $this->render_link($this->sanitizeValue($value), $values);
}
}

View File

@ -29,7 +29,7 @@ class FormatName extends FieldPluginBase {
}
public function query() {
$this->ensure_my_table();
$this->ensureMyTable();
$this->add_additional_fields();
}
@ -40,9 +40,9 @@ class FormatName extends FieldPluginBase {
// filter_formats() will reliably return the default format even if the
// current user is unprivileged.
$format = filter_formats(filter_default_format());
return $this->sanitize_value($format->name);
return $this->sanitizeValue($format->name);
}
return $this->sanitize_value($format_name);
return $this->sanitizeValue($format_name);
}
}

View File

@ -45,18 +45,18 @@ class LinkEdit extends FieldPluginBase {
}
public function query() {
$this->ensure_my_table();
$this->ensureMyTable();
$this->add_additional_fields();
}
function access() {
public function access() {
// Ensure user has access to edit translations.
return user_access('translate interface');
}
function render($values) {
$value = $this->get_value($values, 'lid');
return $this->render_link($this->sanitize_value($value), $values);
return $this->render_link($this->sanitizeValue($value), $values);
}
function render_link($data, $values) {

View File

@ -22,7 +22,7 @@ use Drupal\Core\Annotation\Plugin;
class UidRevision extends Uid {
public function query($group_by = FALSE) {
$this->ensure_my_table();
$this->ensureMyTable();
$placeholder = $this->placeholder();
$this->query->add_where_expression(0, "$this->table_alias.uid = $placeholder OR ((SELECT COUNT(*) FROM {node_revision} nr WHERE nr.uid = $placeholder AND nr.nid = $this->table_alias.nid) > 0)", array($placeholder => $this->argument));
}

View File

@ -25,7 +25,7 @@ use Drupal\Core\Annotation\Plugin;
*/
class HistoryUserTimestamp extends Node {
function init(&$view, &$options) {
public function init(&$view, &$options) {
parent::init($view, $options);
global $user;
if ($user->uid) {

View File

@ -24,7 +24,7 @@ use Drupal\Core\Annotation\Plugin;
*/
class Node extends FieldPluginBase {
function init(&$view, &$options) {
public function init(&$view, &$options) {
parent::init($view, $options);
// Don't add the additional fields to groupby
if (!empty($this->options['link_to_node'])) {
@ -85,7 +85,7 @@ class Node extends FieldPluginBase {
function render($values) {
$value = $this->get_value($values);
return $this->render_link($this->sanitize_value($value), $values);
return $this->render_link($this->sanitizeValue($value), $values);
}
}

View File

@ -46,7 +46,7 @@ class Path extends FieldPluginBase {
}
public function query() {
$this->ensure_my_table();
$this->ensureMyTable();
$this->add_additional_fields();
}

View File

@ -22,7 +22,7 @@ use Drupal\Core\Annotation\Plugin;
*/
class Revision extends Node {
function init(&$view, &$options) {
public function init(&$view, &$options) {
parent::init($view, $options);
if (!empty($this->options['link_to_node_revision'])) {
$this->additional_fields['vid'] = 'vid';

View File

@ -27,7 +27,7 @@ class RevisionLink extends Link {
$this->additional_fields['node_vid'] = array('table' => 'node_revision', 'field' => 'vid');
}
function access() {
public function access() {
return user_access('view revisions') || user_access('administer nodes');
}

View File

@ -22,7 +22,7 @@ use Drupal\Core\Annotation\Plugin;
*/
class RevisionLinkDelete extends RevisionLink {
function access() {
public function access() {
return user_access('delete revisions') || user_access('administer nodes');
}

View File

@ -22,7 +22,7 @@ use Drupal\Core\Annotation\Plugin;
*/
class RevisionLinkRevert extends RevisionLink {
function access() {
public function access() {
return user_access('revert revisions') || user_access('administer nodes');
}

View File

@ -48,9 +48,9 @@ class Type extends Node {
*/
function render_name($data, $values) {
if ($this->options['machine_name'] != 1 && $data !== NULL && $data !== '') {
return t($this->sanitize_value(node_type_get_name($data)));
return t($this->sanitizeValue(node_type_get_name($data)));
}
return $this->sanitize_value($data);
return $this->sanitizeValue($data);
}
function render($values) {

View File

@ -22,9 +22,9 @@ use Drupal\Core\Annotation\Plugin;
*/
class Access extends FilterPluginBase {
function admin_summary() { }
public function adminSummary() { }
function operator_form(&$form, &$form_state) { }
function can_expose() {
public function canExpose() {
return FALSE;
}
@ -33,7 +33,7 @@ class Access extends FilterPluginBase {
*/
public function query() {
if (!user_access('administer nodes')) {
$table = $this->ensure_my_table();
$table = $this->ensureMyTable();
$grants = db_or();
foreach (node_access_grants('view') as $realm => $gids) {
foreach ($gids as $gid) {

View File

@ -28,8 +28,8 @@ class HistoryUserTimestamp extends FilterPluginBase {
// Don't display empty space where the operator would be.
var $no_operator = TRUE;
function expose_form(&$form, &$form_state) {
parent::expose_form($form, $form_state);
public function buildExposeForm(&$form, &$form_state) {
parent::buildExposeForm($form, $form_state);
// @todo There are better ways of excluding required and multiple (object flags)
unset($form['expose']['required']);
unset($form['expose']['multiple']);
@ -72,7 +72,7 @@ class HistoryUserTimestamp extends FilterPluginBase {
$limit = REQUEST_TIME - NODE_NEW_LIMIT;
$this->ensure_my_table();
$this->ensureMyTable();
$field = "$this->table_alias.$this->real_field";
$node = $this->query->ensure_table('node', $this->relationship);
@ -90,7 +90,7 @@ class HistoryUserTimestamp extends FilterPluginBase {
$this->query->add_where_expression($this->options['group'], "($field IS NULL AND ($node.changed > (***CURRENT_TIME*** - $limit) $clause)) OR $field < $node.changed $clause2");
}
function admin_summary() {
public function adminSummary() {
if (!empty($this->options['exposed'])) {
return t('exposed');
}

View File

@ -22,14 +22,14 @@ use Drupal\Core\Annotation\Plugin;
*/
class Status extends FilterPluginBase {
function admin_summary() { }
public function adminSummary() { }
function operator_form(&$form, &$form_state) { }
function can_expose() { return FALSE; }
public function canExpose() { return FALSE; }
public function query() {
$table = $this->ensure_my_table();
$table = $this->ensureMyTable();
$this->query->add_where_expression($this->options['group'], "$table.status = 1 OR ($table.uid = ***CURRENT_USER*** AND ***CURRENT_USER*** <> 0 AND ***VIEW_OWN_UNPUBLISHED_NODES*** = 1) OR ***BYPASS_NODE_ACCESS*** = 1");
}

View File

@ -23,7 +23,7 @@ use Drupal\Core\Annotation\Plugin;
class UidRevision extends Name {
public function query($group_by = FALSE) {
$this->ensure_my_table();
$this->ensureMyTable();
$placeholder = $this->placeholder();

View File

@ -37,7 +37,7 @@ class View extends RowPluginBase {
// Stores the nodes loaded with pre_render.
var $nodes = array();
function init(&$view, &$display, $options = NULL) {
public function init(&$view, &$display, $options = NULL) {
parent::init($view, $display, $options);
// Handle existing views with the deprecated 'teaser' option.
if (isset($this->options['teaser'])) {

View File

@ -57,7 +57,7 @@ class Search extends ArgumentPluginBase {
}
}
else {
$search_index = $this->ensure_my_table();
$search_index = $this->ensureMyTable();
$search_condition = db_and();

Some files were not shown because too many files have changed in this diff Show More