Commit 9bc9242d authored by tim.plunkett's avatar tim.plunkett
Browse files

Issue #1734904 by tim.plunkett: Clean up plugins.

parent e5a4ab8a
......@@ -137,4 +137,5 @@ public function formatMessages(array $messages) {
static function formatMessage($message, $type = 'error') {
return array('message' => $message, 'type' => $type);
}
}
......@@ -59,14 +59,20 @@
* - - numeric: If true, the value will not be surrounded in quotes.
* - - extra type: How all the extras will be combined. Either AND or OR. Defaults to AND.
*/
class Join {
var $table = NULL;
var $left_table = NULL;
var $left_field = NULL;
var $field = NULL;
var $extra = NULL;
var $type = NULL;
var $definition = array();
/**
......@@ -204,6 +210,7 @@ function build_join($select_query, $table, $view_query) {
$select_query->addJoin($this->type, $right_table, $table['alias'], $condition, $arguments);
}
}
/**
......
......@@ -19,6 +19,7 @@
* - left_query: The subquery to use in the left side of the join clause.
*/
class JoinSubquery extends Join {
function construct($table = NULL, $left_table = NULL, $left_field = NULL, $field = NULL, $extra = array(), $type = 'LEFT') {
parent::construct($table, $left_table, $left_field, $field, $extra, $type);
$this->left_query = $this->definition['left_query'];
......@@ -99,4 +100,5 @@ function build_join($select_query, $table, $view_query) {
$select_query->addJoin($this->type, $right_table, $table['alias'], $condition, $arguments);
}
}
......@@ -13,6 +13,7 @@
* Discovery interface which supports the hook_views_plugins mechanism.
*/
class ViewsDiscovery extends AnnotatedClassDiscovery {
public function getDefinitions() {
$definitions = parent::getDefinitions();
foreach ($definitions as $definition) {
......@@ -51,4 +52,5 @@ public function getDefinitions() {
return $definitions;
}
}
......@@ -13,6 +13,7 @@
use Drupal\Core\Plugin\Discovery\CacheDecorator;
class ViewsPluginManager extends PluginManagerBase {
/**
* The handler type of this plugin manager, for example filter or field.
*
......@@ -26,4 +27,5 @@ public function __construct($type) {
$this->discovery = new CacheDecorator(new ViewsDiscovery('views', $this->type), 'views:' . $this->type, 'cache');
$this->factory = new DefaultFactory($this->discovery);
}
}
......@@ -9,7 +9,8 @@
use Drupal\views\Plugin\views\Plugin;
use Drupal\views\View;
class Handler extends Plugin {
abstract class Handler extends Plugin {
/**
* Where the $query object will reside:
*
......@@ -603,4 +604,5 @@ function validate() { return array(); }
* a placeholder used when a handler can't be found.
*/
function broken() { }
}
......@@ -451,4 +451,5 @@ function plugin_title() {
}
return check_plain($this->definition['title']);
}
}
......@@ -21,6 +21,7 @@
* The base plugin to handle access control.
*/
abstract class AccessPluginBase extends Plugin {
/**
* Initialize the plugin.
*
......@@ -93,6 +94,7 @@ function get_access_callback() {
// default to no access control.
return TRUE;
}
}
/**
......
......@@ -14,9 +14,7 @@
* Access plugin that provides no access control at all.
*
* @ingroup views_access_plugins
*/
/**
*
* @Plugin(
* id = "none",
* title = @Translation("None"),
......@@ -25,7 +23,9 @@
* )
*/
class None extends AccessPluginBase {
function summary_title() {
return t('Unrestricted');
}
}
......@@ -14,9 +14,7 @@
* Access plugin that provides permission-based access control.
*
* @ingroup views_access_plugins
*/
/**
*
* @Plugin(
* id = "perm",
* title = @Translation("Permission"),
......@@ -26,6 +24,7 @@
* )
*/
class Permission extends AccessPluginBase {
function access($account) {
return views_check_perm($this->options['perm'], $account);
}
......@@ -74,4 +73,5 @@ function options_form(&$form, &$form_state) {
'#description' => t('Only users with the selected permission flag will be able to access this display. Note that users with "access all views" can see any view, regardless of other permissions.'),
);
}
}
......@@ -14,9 +14,7 @@
* Access plugin that provides role-based access control.
*
* @ingroup views_access_plugins
*/
/**
*
* @Plugin(
* id = "role",
* title = @Translation("Role"),
......@@ -26,6 +24,7 @@
* )
*/
class Role extends AccessPluginBase {
function access($account) {
return views_check_roles(array_filter($this->options['role']), $account);
}
......@@ -78,4 +77,5 @@ function options_submit(&$form, &$form_state) {
// I hate checkboxes.
$form_state['values']['access_options']['role'] = array_filter($form_state['values']['access_options']['role']);
}
}
......@@ -22,10 +22,7 @@
*
* @ingroup views_area_handlers
*/
/**
*/
class AreaPluginBase extends Handler {
abstract class AreaPluginBase extends Handler {
/**
* Overrides Handler::init().
......@@ -108,6 +105,7 @@ function render($empty = FALSE) {
function use_group_by() {
return FALSE;
}
}
/**
......
......@@ -13,14 +13,13 @@
* A special handler to take the place of missing or broken handlers.
*
* @ingroup views_area_handlers
*/
/**
*
* @Plugin(
* id = "broken"
* )
*/
class Broken extends AreaPluginBase {
function ui_name($short = FALSE) {
return t('Broken/missing handler');
}
......@@ -37,5 +36,8 @@ function options_form(&$form, &$form_state) {
/**
* Determine if the handler is considered 'broken'
*/
function broken() { return TRUE; }
function broken() {
return TRUE;
}
}
......@@ -13,9 +13,7 @@
* Views area handler to display some configurable result summary.
*
* @ingroup views_area_handlers
*/
/**
*
* @Plugin(
* id = "result"
* )
......@@ -103,4 +101,5 @@ function render($empty = FALSE) {
}
return $output;
}
}
......@@ -13,9 +13,7 @@
* Views area text handler.
*
* @ingroup views_area_handlers
*/
/**
*
* @Plugin(
* id = "text"
* )
......@@ -117,4 +115,5 @@ function render_textarea($value, $format) {
return check_markup($value, $format, '', FALSE);
}
}
}
......@@ -13,9 +13,7 @@
* Views area text handler.
*
* @ingroup views_area_handlers
*/
/**
*
* @Plugin(
* id = "text_custom"
* )
......
......@@ -13,9 +13,7 @@
* Views area handlers. Insert a view inside of an area.
*
* @ingroup views_area_handlers
*/
/**
*
* @Plugin(
* id = "view"
* )
......@@ -90,4 +88,5 @@ function render($empty = FALSE) {
}
return '';
}
}
......@@ -40,10 +40,7 @@
*
* @ingroup views_argument_handlers
*/
/**
*/
class ArgumentPluginBase extends Handler {
abstract class ArgumentPluginBase extends Handler {
var $validator = NULL;
var $argument = NULL;
......
......@@ -13,14 +13,13 @@
* A special handler to take the place of missing or broken handlers.
*
* @ingroup views_argument_handlers
*/
/**
*
* @Plugin(
* id = "broken"
* )
*/
class Broken extends ArgumentPluginBase {
function ui_name($short = FALSE) {
return t('Broken/missing handler');
}
......@@ -37,4 +36,5 @@ function options_form(&$form, &$form_state) {
* Determine if the handler is considered 'broken'
*/
function broken() { return TRUE; }
}
......@@ -26,9 +26,7 @@
* @see Drupal\views\ManyTonOneHelper
*
* @ingroup views_argument_handlers
*/
/**
*
* @Plugin(
* id = "date"
* )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment