Commit 021900be authored by catch's avatar catch

Issue #2219661 by damiankloip: Rename ViewExecutable::viewsHandlerTypes to getHandlerTypes.

parent e1dd5a1e
......@@ -282,7 +282,7 @@ public function calculateDependencies() {
}
$handler_types = array();
foreach (ViewExecutable::viewsHandlerTypes() as $type) {
foreach (ViewExecutable::getHandlerTypes() as $type) {
$handler_types[] = $type['plural'];
}
foreach ($this->get('display') as $display) {
......
......@@ -32,7 +32,7 @@ class ViewsHandlerManager extends DefaultPluginManager {
*
* @var string
*
* @see \Drupal\views\ViewExecutable::viewsHandlerTypes().
* @see \Drupal\views\ViewExecutable::getHandlerTypes().
*/
protected $handlerType;
......
......@@ -868,7 +868,7 @@ public function submitTemporaryForm($form, &$form_state) {
// Run it through the handler's submit function.
$this->submitOptionsForm($form['options'], $form_state);
$item = $this->options;
$types = ViewExecutable::viewsHandlerTypes();
$types = ViewExecutable::getHandlerTypes();
// For footer/header $handler_type is area but $type is footer/header.
// For all other handle types it's the same.
......
......@@ -881,7 +881,7 @@ public function &getHandler($type, $id) {
public function getHandlers($type) {
if (!isset($this->handlers[$type])) {
$this->handlers[$type] = array();
$types = ViewExecutable::viewsHandlerTypes();
$types = ViewExecutable::getHandlerTypes();
$plural = $types[$type]['plural'];
foreach ($this->getOption($plural) as $id => $info) {
......@@ -2285,7 +2285,7 @@ public function validate() {
}
// Validate handlers
foreach (ViewExecutable::viewsHandlerTypes() as $type => $info) {
foreach (ViewExecutable::getHandlerTypes() as $type => $info) {
foreach ($this->getHandlers($type) as $handler) {
$result = $handler->validate();
if (!empty($result) && is_array($result)) {
......@@ -2324,7 +2324,7 @@ public function remove() {
*
*/
public function isIdentifierUnique($id, $identifier) {
foreach (ViewExecutable::viewsHandlerTypes() as $type => $info) {
foreach (ViewExecutable::getHandlerTypes() as $type => $info) {
foreach ($this->getHandlers($type) as $key => $handler) {
if ($handler->canExpose() && $handler->isExposed()) {
if ($handler->isAGroup()) {
......@@ -2448,7 +2448,7 @@ public function mergeDefaults() {
// Build a map of plural => singular for handler types.
$type_map = array();
foreach (ViewExecutable::viewsHandlerTypes() as $type => $info) {
foreach (ViewExecutable::getHandlerTypes() as $type => $info) {
$type_map[$info['plural']] = $type;
}
......@@ -2487,7 +2487,7 @@ protected function mergePlugin($type) {
* The name of the handler type option.
*/
protected function mergeHandler($type) {
$types = ViewExecutable::viewsHandlerTypes();
$types = ViewExecutable::getHandlerTypes();
$options = $this->getOption($types[$type]['plural']);
foreach ($this->getHandlers($type) as $id => $handler) {
......
......@@ -56,7 +56,7 @@ public function testHandlers() {
$this->drupalCreateContentType(array('type' => 'article'));
$this->container->get('comment.manager')->addDefaultField('node', 'article');
$object_types = array_keys(ViewExecutable::viewsHandlerTypes());
$object_types = array_keys(ViewExecutable::getHandlerTypes());
foreach ($this->container->get('views.views_data')->get() as $base_table => $info) {
if (!isset($info['table']['base'])) {
continue;
......
......@@ -58,7 +58,7 @@ protected function viewsData() {
// and arguments.
$data['views_test_data']['access_callback'] = $data['views_test_data']['id'];
$data['views_test_data']['access_callback_arguments'] = $data['views_test_data']['id'];
foreach (ViewExecutable::viewsHandlerTypes() as $type => $info) {
foreach (ViewExecutable::getHandlerTypes() as $type => $info) {
if (isset($data['views_test_data']['access_callback'][$type]['id'])) {
$data['views_test_data']['access_callback'][$type]['access callback'] = 'views_test_data_handler_test_access_callback';
......
......@@ -122,7 +122,7 @@ public function testInitMethods() {
$view->initHandlers();
// Check for all handler types.
$handler_types = array_keys(ViewExecutable::viewsHandlerTypes());
$handler_types = array_keys(ViewExecutable::getHandlerTypes());
foreach ($handler_types as $type) {
// The views_test integration doesn't have relationships.
if ($type == 'relationship') {
......@@ -392,10 +392,10 @@ protected function getProtectedProperty($instance, $property) {
}
/**
* Tests ViewExecutable::viewsHandlerTypes().
* Tests ViewExecutable::getHandlerTypes().
*/
public function testViewsHandlerTypes() {
$types = ViewExecutable::viewsHandlerTypes();
public function testGetHandlerTypes() {
$types = ViewExecutable::getHandlerTypes();
foreach (array('field', 'filter', 'argument', 'sort', 'header', 'footer', 'empty') as $type) {
$this->assertTrue(isset($types[$type]));
// @todo The key on the display should be footers, headers and empties
......
......@@ -786,7 +786,7 @@ public function initStyle() {
public function initHandlers() {
$this->initDisplay();
if (empty($this->inited)) {
foreach ($this::viewsHandlerTypes() as $key => $info) {
foreach ($this::getHandlerTypes() as $key => $info) {
$this->_initHandler($key, $info);
}
$this->inited = TRUE;
......@@ -863,7 +863,7 @@ public function getBaseTables() {
* Run the preQuery() on all active handlers.
*/
protected function _preQuery() {
foreach ($this::viewsHandlerTypes() as $key => $info) {
foreach ($this::getHandlerTypes() as $key => $info) {
$handlers = &$this->$key;
$position = 0;
foreach ($handlers as $id => $handler) {
......@@ -878,7 +878,7 @@ protected function _preQuery() {
* Run the postExecute() on all active handlers.
*/
protected function _postExecute() {
foreach ($this::viewsHandlerTypes() as $key => $info) {
foreach ($this::getHandlerTypes() as $key => $info) {
$handlers = &$this->$key;
foreach ($handlers as $id => $handler) {
$handlers[$id]->postExecute($this->result);
......@@ -892,7 +892,7 @@ protected function _postExecute() {
* @param $key
* One of 'argument', 'field', 'sort', 'filter', 'relationship'
* @param $info
* The $info from viewsHandlerTypes for this object.
* The $info from getHandlerTypes for this object.
*/
protected function _initHandler($key, $info) {
// Load the requested items from the display onto the object.
......@@ -1770,7 +1770,7 @@ public function createDuplicate() {
* collected.
*/
public function destroy() {
foreach ($this::viewsHandlerTypes() as $type => $info) {
foreach ($this::getHandlerTypes() as $type => $info) {
if (isset($this->$type)) {
foreach ($this->{$type} as $handler) {
$handler->destroy();
......@@ -1838,7 +1838,7 @@ public function validate() {
* - (optional) type: The actual internal used handler type. This key is
* just used for header,footer,empty to link to the internal type: area.
*/
public static function viewsHandlerTypes() {
public static function getHandlerTypes() {
static $retval = NULL;
// Statically cache this so t() doesn't run a bajillion times.
......@@ -1962,7 +1962,7 @@ public static function getPluginTypes() {
* The unique ID for this handler instance.
*/
public function addHandler($display_id, $type, $table, $field, $options = array(), $id = NULL) {
$types = $this::viewsHandlerTypes();
$types = $this::getHandlerTypes();
$this->setDisplay($display_id);
$fields = $this->displayHandlers->get($display_id)->getOption($types[$type]['plural']);
......@@ -2040,7 +2040,7 @@ public function getHandlers($type, $display_id = NULL) {
}
// Get info about the types so we can get the right data.
$types = static::viewsHandlerTypes();
$types = static::getHandlerTypes();
return $this->displayHandlers->get($display_id)->getOption($types[$type]['plural']);
}
......@@ -2060,7 +2060,7 @@ public function getHandlers($type, $display_id = NULL) {
*/
public function getHandler($display_id, $type, $id) {
// Get info about the types so we can get the right data.
$types = static::viewsHandlerTypes();
$types = static::getHandlerTypes();
// Initialize the display
$this->setDisplay($display_id);
......@@ -2086,7 +2086,7 @@ public function getHandler($display_id, $type, $id) {
*/
public function setHandler($display_id, $type, $id, $item) {
// Get info about the types so we can get the right data.
$types = static::viewsHandlerTypes();
$types = static::getHandlerTypes();
// Initialize the display.
$this->setDisplay($display_id);
......@@ -2112,7 +2112,7 @@ public function setHandler($display_id, $type, $id, $item) {
*/
public function removeHandler($display_id, $type, $id) {
// Get info about the types so we can get the right data.
$types = static::viewsHandlerTypes();
$types = static::getHandlerTypes();
// Initialize the display.
$this->setDisplay($display_id);
......
......@@ -63,7 +63,7 @@ public function reportFields() {
// Fetch all fieldapi fields which are used in views
// Therefore search in all views, displays and handler-types.
$fields = array();
$handler_types = ViewExecutable::viewsHandlerTypes();
$handler_types = ViewExecutable::getHandlerTypes();
foreach ($views as $view) {
$executable = $view->getExecutable();
$executable->initDisplay();
......
......@@ -64,7 +64,7 @@ public function buildForm(array $form, array &$form_state) {
$executable->setDisplay($display_id);
$display = &$executable->displayHandlers->get($display_id);
$types = ViewExecutable::viewsHandlerTypes();
$types = ViewExecutable::getHandlerTypes();
$ltitle = $types[$type]['ltitle'];
$section = $types[$type]['plural'];
......
......@@ -74,7 +74,7 @@ public function buildForm(array $form, array &$form_state) {
$form['markup'] = array('#markup' => $this->t("Error: handler for @table > @field doesn't exist!", array('@table' => $item['table'], '@field' => $item['field'])));
}
else {
$types = ViewExecutable::viewsHandlerTypes();
$types = ViewExecutable::getHandlerTypes();
// If this item can come from the default display, show a dropdown
// that lets the user choose which display the changes should apply to.
......@@ -204,7 +204,7 @@ public function submitForm(array &$form, array &$form_state) {
// Run it through the handler's submit function.
$form_state['handler']->submitOptionsForm($form['options'], $form_state);
$item = $form_state['handler']->options;
$types = ViewExecutable::viewsHandlerTypes();
$types = ViewExecutable::getHandlerTypes();
// For footer/header $handler_type is area but $type is footer/header.
// For all other handle types it's the same.
......
......@@ -73,7 +73,7 @@ public function buildForm(array $form, array &$form_state) {
}
else {
$handler->init($executable, $executable->display_handler, $item);
$types = ViewExecutable::viewsHandlerTypes();
$types = ViewExecutable::getHandlerTypes();
$form['#title'] = $this->t('Configure extra settings for @type %item', array('@type' => $types[$type]['lstitle'], '%item' => $handler->adminLabel()));
......
......@@ -79,7 +79,7 @@ public function buildForm(array $form, array &$form_state) {
}
else {
$handler->init($executable, $executable->display_handler, $item);
$types = ViewExecutable::viewsHandlerTypes();
$types = ViewExecutable::getHandlerTypes();
$form['#title'] = $this->t('Configure aggregation settings for @type %item', array('@type' => $types[$type]['lstitle'], '%item' => $handler->adminLabel()));
......
......@@ -52,7 +52,7 @@ public function buildForm(array $form, array &$form_state) {
$display_id = $form_state['display_id'];
$type = $form_state['type'];
$types = ViewExecutable::viewsHandlerTypes();
$types = ViewExecutable::getHandlerTypes();
$executable = $view->getExecutable();
$executable->setDisplay($display_id);
$display = &$executable->displayHandlers->get($display_id);
......@@ -135,7 +135,7 @@ public function buildForm(array $form, array &$form_state) {
* {@inheritdoc}
*/
public function submitForm(array &$form, array &$form_state) {
$types = ViewExecutable::viewsHandlerTypes();
$types = ViewExecutable::getHandlerTypes();
$display = &$form_state['view']->getExecutable()->displayHandlers->get($form_state['display_id']);
$old_fields = $display->getOption($types[$form_state['type']]['plural']);
......
......@@ -38,7 +38,7 @@ public function buildForm(array $form, array &$form_state) {
$display_id = $form_state['display_id'];
$type = 'filter';
$types = ViewExecutable::viewsHandlerTypes();
$types = ViewExecutable::getHandlerTypes();
$executable = $view->getExecutable();
if (!$executable->setDisplay($display_id)) {
views_ajax_render($this->t('Invalid display id @display', array('@display' => $display_id)));
......@@ -214,7 +214,7 @@ public function buildForm(array $form, array &$form_state) {
* {@inheritdoc}
*/
public function submitForm(array &$form, array &$form_state) {
$types = ViewExecutable::viewsHandlerTypes();
$types = ViewExecutable::getHandlerTypes();
$display = &$form_state['view']->getExecutable()->displayHandlers->get($form_state['display_id']);
$remember_groups = array();
......
......@@ -75,7 +75,7 @@ protected function viewsData() {
* Tests UI CRUD.
*/
public function testUICRUD() {
$handler_types = ViewExecutable::viewsHandlerTypes();
$handler_types = ViewExecutable::getHandlerTypes();
foreach ($handler_types as $type => $type_info) {
// Test adding handlers.
$add_handler_url = "admin/structure/views/nojs/add-handler/test_view_empty/default/$type";
......@@ -148,7 +148,7 @@ public function testUICRUD() {
* Tests broken handlers.
*/
public function testBrokenHandlers() {
$handler_types = ViewExecutable::viewsHandlerTypes();
$handler_types = ViewExecutable::getHandlerTypes();
foreach ($handler_types as $type => $type_info) {
$this->drupalGet('admin/structure/views/view/test_view_broken/edit');
......@@ -182,7 +182,7 @@ public function testBrokenHandlers() {
* Tests optional handlers.
*/
public function testOptionalHandlers() {
$handler_types = ViewExecutable::viewsHandlerTypes();
$handler_types = ViewExecutable::getHandlerTypes();
foreach ($handler_types as $type => $type_info) {
$this->drupalGet('admin/structure/views/view/test_view_optional/edit');
......
......@@ -911,7 +911,7 @@ public function getFormBucket(ViewUI $view, $type, $display) {
$executable->setDisplay($display['id']);
$executable->initStyle();
$types = $executable->viewsHandlerTypes();
$types = $executable->getHandlerTypes();
$build = array(
'#theme_wrappers' => array('views_ui_display_tab_bucket'),
......
......@@ -475,7 +475,7 @@ public function addFormToStack($key, $display_id, $type, $id = NULL, $top = FALS
*/
public function submitItemAdd($form, &$form_state) {
$type = $form_state['type'];
$types = ViewExecutable::viewsHandlerTypes();
$types = ViewExecutable::getHandlerTypes();
$section = $types[$type]['plural'];
// Handle the override select.
......
......@@ -198,7 +198,7 @@ function views_ui_view_preview_section_handler_links(ViewExecutable $view, $type
$handlers = $view->display_handler->getHandlers($type);
$links = array();
$types = ViewExecutable::viewsHandlerTypes();
$types = ViewExecutable::getHandlerTypes();
if ($title) {
$links[$type . '-title'] = array(
'title' => $types[$type]['title'],
......
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