Commit 9e4cdb98 authored by webchick's avatar webchick

Issue #2143495 by dawehner, derhasi: Improve naming of ViewExecutable::addItem(), ::getItem() & Co.

parent 4fbb1a1b
......@@ -32,7 +32,7 @@ public static function getInfo() {
function testCommentUserUIDTest() {
$view = views_get_view('test_comment_user_uid');
$view->setDisplay();
$view->removeItem('default', 'argument', 'uid_touch');
$view->removeHandler('default', 'argument', 'uid_touch');
$options = array(
'id' => 'uid_touch',
......@@ -40,7 +40,7 @@ function testCommentUserUIDTest() {
'field' => 'uid_touch',
'value' => array($this->loggedInUser->id()),
);
$view->addItem('default', 'filter', 'node_field_data', 'uid_touch', $options);
$view->addHandler('default', 'filter', 'node_field_data', 'uid_touch', $options);
$this->executeView($view, array($this->account->id()));
$result_set = array(
array(
......
......@@ -51,7 +51,7 @@ public function buildOptionsForm(&$form, &$form_state) {
public function preRender($row) {
// Force all fields to be inline by default.
if (empty($this->options['inline'])) {
$fields = $this->view->getItems('field', $this->displayHandler->display['id']);
$fields = $this->view->getHandlers('field', $this->displayHandler->display['id']);
$this->options['inline'] = drupal_map_assoc(array_keys($fields));
}
......
......@@ -63,7 +63,7 @@ public function setUp() {
* Tests basic field handler settings in the UI.
*/
public function testHandlerUI() {
$url = "admin/structure/views/nojs/config-item/test_view_fieldapi/default/field/field_name_0";
$url = "admin/structure/views/nojs/handler/test_view_fieldapi/default/field/field_name_0";
$this->drupalGet($url);
// Tests the available formatter options.
......@@ -101,7 +101,7 @@ public function testHandlerUIAggregation() {
$edit = array('group_by' => '1');
$this->drupalPostForm('admin/structure/views/nojs/display/test_view_fieldapi/default/group_by', $edit, t('Apply'));
$url = "admin/structure/views/nojs/config-item/test_view_fieldapi/default/field/field_name_0";
$url = "admin/structure/views/nojs/handler/test_view_fieldapi/default/field/field_name_0";
$this->drupalGet($url);
$this->assertResponse(200);
......
......@@ -76,7 +76,7 @@ public function testFilterUI() {
}
}
$this->drupalGet('admin/structure/views/nojs/config-item/test_filter_taxonomy_index_tid/default/filter/tid');
$this->drupalGet('admin/structure/views/nojs/handler/test_filter_taxonomy_index_tid/default/filter/tid');
$result = $this->xpath('//select[@id="edit-options-value"]/option');
......@@ -100,7 +100,7 @@ public function testFilterUI() {
$display =& $view->getDisplay('default');
$display['display_options']['filters']['tid']['type'] = 'textfield';
$view->save();
$this->drupalGet('admin/structure/views/nojs/config-item/test_filter_taxonomy_index_tid/default/filter/tid');
$this->drupalGet('admin/structure/views/nojs/handler/test_filter_taxonomy_index_tid/default/filter/tid');
$result = $this->xpath('//input[@id="edit-options-value"]/@data-autocomplete-path');
$this->assertEqual((string) $result[0], url('taxonomy/autocomplete_vid/tags'));
}
......
......@@ -60,7 +60,7 @@ public function testUserUid() {
$view->destroy();
// Remove the filter now, so only the argument will affect the query.
$view->removeItem('default', 'filter', 'uid_touch_tracker');
$view->removeHandler('default', 'filter', 'uid_touch_tracker');
// Test the incorrect argument UID.
$view->initHandlers();
......
......@@ -82,7 +82,7 @@ public function testBulkForm() {
// Remove the user status filter from the view.
$view = views_get_view('test_user_bulk_form');
$view->removeItem('default', 'filter', 'status');
$view->removeHandler('default', 'filter', 'status');
$view->storage->save();
// Ensure the anonymous user is found.
......
......@@ -98,7 +98,7 @@ public function testAdminUserInterface() {
$admin_user = $this->drupalCreateUser(array('administer views', 'administer site configuration'));
$this->drupalLogin($admin_user);
$path = 'admin/structure/views/nojs/config-item/test_user_name/default/filter/uid';
$path = 'admin/structure/views/nojs/handler/test_user_name/default/filter/uid';
$this->drupalGet($path);
// Pass in an invalid username, the validation should catch it.
......
......@@ -852,7 +852,7 @@ public function displayExposedForm($form, &$form_state) {
$this->defaultExposeOptions();
}
$form_state['view']->getExecutable()->setItem($form_state['display_id'], $form_state['type'], $form_state['id'], $item);
$form_state['view']->getExecutable()->setHandler($form_state['display_id'], $form_state['type'], $form_state['id'], $item);
$form_state['view']->addFormToStack($form_state['form_key'], $form_state['display_id'], $form_state['type'], $form_state['id'], TRUE, TRUE);
......
......@@ -426,7 +426,7 @@ public function buildGroupForm($form, &$form_state) {
$this->buildGroupOptions();
}
$form_state['view']->getExecutable()->setItem($form_state['display_id'], $form_state['type'], $form_state['id'], $item);
$form_state['view']->getExecutable()->setHandler($form_state['display_id'], $form_state['type'], $form_state['id'], $item);
$form_state['view']->addFormToStack($form_state['form_key'], $form_state['display_id'], $form_state['type'], $form_state['id'], TRUE, TRUE);
......@@ -1089,7 +1089,7 @@ public function addGroupForm($form, &$form_state) {
// Add a new row.
$item['group_info']['group_items'][] = array();
$form_state['view']->getExecutable()->setItem($form_state['display_id'], $form_state['type'], $form_state['id'], $item);
$form_state['view']->getExecutable()->setHandler($form_state['display_id'], $form_state['type'], $form_state['id'], $item);
$form_state['view']->cacheSet();
$form_state['rerender'] = TRUE;
......
......@@ -205,7 +205,7 @@ protected function leftQuery($options) {
$sort = $options['subquery_sort'];
list($sort_table, $sort_field) = explode('.', $sort);
$sort_options = array('order' => $options['subquery_order']);
$temp_view->addItem('default', 'sort', $sort_table, $sort_field, $sort_options);
$temp_view->addHandler('default', 'sort', $sort_table, $sort_field, $sort_options);
}
// Get the namespace string.
......@@ -217,20 +217,20 @@ protected function leftQuery($options) {
$temp_view->args[] = '**CORRELATED**';
// Add the base table ID field.
$temp_view->addItem('default', 'field', $this->definition['base'], $this->definition['field']);
$temp_view->addHandler('default', 'field', $this->definition['base'], $this->definition['field']);
$relationship_id = NULL;
// Add the used relationship for the subjoin, if defined.
if (isset($this->definition['relationship'])) {
list($relationship_table, $relationship_field) = explode(':', $this->definition['relationship']);
$relationship_id = $temp_view->addItem('default', 'relationship', $relationship_table, $relationship_field);
$relationship_id = $temp_view->addHandler('default', 'relationship', $relationship_table, $relationship_field);
}
$temp_item_options = array('relationship' => $relationship_id);
// Add the correct argument for our relationship's base
// ie the 'how to get back to base' argument.
// The relationship definition tells us which one to use.
$temp_view->addItem('default', 'argument', $this->definition['argument table'], $this->definition['argument field'], $temp_item_options);
$temp_view->addHandler('default', 'argument', $this->definition['argument table'], $this->definition['argument field'], $temp_item_options);
// Build the view. The creates the query object and produces the query
// string but does not run any queries.
......@@ -269,7 +269,7 @@ protected function leftQuery($options) {
$where = &$subquery->conditions();
$this->alterSubqueryCondition($subquery, $where);
// Not sure why, but our sort order clause doesn't have a table.
// TODO: the call to add_item() above to add the sort handler is probably
// TODO: the call to addHandler() above to add the sort handler is probably
// wrong -- needs attention from someone who understands it.
// In the meantime, this works, but with a leap of faith...
$orders = &$subquery->getOrderBy();
......
......@@ -103,9 +103,9 @@ public function testEntityArea() {
// Change the view mode of the area handler.
$view = views_get_view('test_entity_area');
$item = $view->getItem('default', 'header', 'entity_entity_test');
$item = $view->getHandler('default', 'header', 'entity_entity_test');
$item['view_mode'] = 'test';
$view->setItem('default', 'header', 'entity_entity_test', $item);
$view->setHandler('default', 'header', 'entity_entity_test', $item);
$preview = $view->preview('default', array($entities[1]->id()));
$this->drupalSetContent(drupal_render($preview));
......
......@@ -67,7 +67,7 @@ public function testUI() {
$types = array('header', 'footer', 'empty');
$labels = array();
foreach ($types as $type) {
$edit_path = 'admin/structure/views/nojs/config-item/test_example_area/default/' . $type .'/test_example';
$edit_path = 'admin/structure/views/nojs/handler/test_example_area/default/' . $type .'/test_example';
// First setup an empty label.
$this->drupalPostForm($edit_path, array(), t('Apply'));
......@@ -127,7 +127,7 @@ public function testRenderAreaToken() {
$view = views_get_view('test_example_area');
$view->initHandlers();
$this->drupalGet('admin/structure/views/nojs/config-item/test_example_area/default/empty/test_example');
$this->drupalGet('admin/structure/views/nojs/handler/test_example_area/default/empty/test_example');
// Test that the list is token present.
$element = $this->xpath('//ul[@class="global-tokens"]');
......
......@@ -153,7 +153,7 @@ protected function _testUiValidation() {
$this->drupalLogin($this->drupalCreateUser(array('administer views', 'administer site configuration')));
menu_router_rebuild();
$this->drupalGet('admin/structure/views/view/test_filter_date_between/edit');
$this->drupalGet('admin/structure/views/nojs/config-item/test_filter_date_between/default/filter/created');
$this->drupalGet('admin/structure/views/nojs/handler/test_filter_date_between/default/filter/created');
$edit = array();
// Generate a definitive wrong value, which should be checked by validation.
......
......@@ -85,7 +85,7 @@ public function testHandlers() {
$options['value'] = array(1);
}
}
$view->addItem('default', $type, $base_table, $field, $options);
$view->addHandler('default', $type, $base_table, $field, $options);
}
}
}
......
......@@ -78,7 +78,7 @@ function testFilterInOperatorUi() {
$this->drupalLogin($admin_user);
menu_router_rebuild();
$path = 'admin/structure/views/nojs/config-item/test_filter_in_operator_ui/default/filter/type';
$path = 'admin/structure/views/nojs/handler/test_filter_in_operator_ui/default/filter/type';
$this->drupalGet($path);
$this->assertFieldByName('options[expose][reduce]', FALSE);
......@@ -244,7 +244,7 @@ public function testRelationshipUI() {
$this->drupalLogin($views_admin);
// Make sure the link to the field options exists.
$handler_options_path = 'admin/structure/views/nojs/config-item/test_handler_relationships/default/field/title';
$handler_options_path = 'admin/structure/views/nojs/handler/test_handler_relationships/default/field/title';
$view_edit_path = 'admin/structure/views/view/test_handler_relationships/edit';
$this->drupalGet($view_edit_path);
$this->assertLinkByHref($handler_options_path);
......@@ -270,7 +270,7 @@ public function testRelationshipUI() {
$this->assertEqual($options, $expected_options);
// Remove the relationship and make sure no relationship option appears.
$this->drupalPostForm('admin/structure/views/nojs/config-item/test_handler_relationships/default/relationship/nid', array(), t('Remove'));
$this->drupalPostForm('admin/structure/views/nojs/handler/test_handler_relationships/default/relationship/nid', array(), t('Remove'));
$this->drupalGet($handler_options_path);
$this->assertNoFieldByName($relationship_name, 'Make sure that no relationship option is available');
}
......@@ -282,9 +282,9 @@ public function testSetRelationship() {
$view = views_get_view('test_handler_relationships');
$view->setDisplay();
// Setup a broken relationship.
$view->addItem('default', 'relationship', $this->randomName(), $this->randomName(), array(), 'broken_relationship');
$view->addHandler('default', 'relationship', $this->randomName(), $this->randomName(), array(), 'broken_relationship');
// Setup a valid relationship.
$view->addItem('default', 'relationship', 'comment', 'node', array('relationship' => 'cid'), 'valid_relationship');
$view->addHandler('default', 'relationship', 'comment', 'node', array('relationship' => 'cid'), 'valid_relationship');
$view->initHandlers();
$field = $view->field['title'];
......
......@@ -59,7 +59,7 @@ public function testArgumentDefaultPlugin() {
),
'default_action' => 'default'
);
$id = $view->addItem('default', 'argument', 'views_test_data', 'name', $options);
$id = $view->addHandler('default', 'argument', 'views_test_data', 'name', $options);
$view->initHandlers();
$plugin = $view->argument[$id]->getPlugin('argument_default');
$this->assertTrue($plugin instanceof ArgumentDefaultTestPlugin, 'The correct argument default plugin is used.');
......@@ -94,7 +94,7 @@ function testArgumentDefaultNoOptions() {
$edit = array(
'options[default_argument_type]' => $argument_type,
);
$this->drupalPostForm('admin/structure/views/nojs/config-item/test_argument_default_current_user/default/argument/uid', $edit, t('Apply'));
$this->drupalPostForm('admin/structure/views/nojs/handler/test_argument_default_current_user/default/argument/uid', $edit, t('Apply'));
// Note, the undefined index error has two spaces after it.
$error = array(
......
......@@ -297,26 +297,26 @@ public function testOutputIsEmpty() {
'id' => 'id',
'value' => array('value' => 7297)
);
$view->setItem('default', 'filter', 'id', $item);
$view->setHandler('default', 'filter', 'id', $item);
$this->executeView($view);
$this->assertFalse(count($view->result), 'Ensure the result of the view is empty.');
$this->assertFalse($view->display_handler->outputIsEmpty(), 'Ensure the view output is marked as not empty, because the empty text still appears.');
$view->destroy();
// Remove the empty area, but mark the header area to still appear.
$view->removeItem('default', 'empty', 'area');
$item = $view->getItem('default', 'header', 'area');
$view->removeHandler('default', 'empty', 'area');
$item = $view->getHandler('default', 'header', 'area');
$item['empty'] = TRUE;
$view->setItem('default', 'header', 'area', $item);
$view->setHandler('default', 'header', 'area', $item);
$this->executeView($view);
$this->assertFalse(count($view->result), 'Ensure the result of the view is empty.');
$this->assertFalse($view->display_handler->outputIsEmpty(), 'Ensure the view output is marked as not empty, because the header text still appears.');
$view->destroy();
// Hide the header on empty results.
$item = $view->getItem('default', 'header', 'area');
$item = $view->getHandler('default', 'header', 'area');
$item['empty'] = FALSE;
$view->setItem('default', 'header', 'area', $item);
$view->setHandler('default', 'header', 'area', $item);
$this->executeView($view);
$this->assertFalse(count($view->result), 'Ensure the result of the view is empty.');
$this->assertTrue($view->display_handler->outputIsEmpty(), 'Ensure the view output is marked as empty.');
......
......@@ -308,10 +308,10 @@ public function testPropertyMethods() {
$view->setResponse($new_response);
$this->assertIdentical(spl_object_hash($view->getResponse()), spl_object_hash($new_response), 'New response object correctly set.');
// Test the generateItemId() method.
// Test the generateHandlerId() method.
$test_ids = drupal_map_assoc(array('test', 'test_1'));
$this->assertEqual($view->generateItemId('new', $test_ids), 'new');
$this->assertEqual($view->generateItemId('test', $test_ids), 'test_2');
$this->assertEqual($view->generateHandlerId('new', $test_ids), 'new');
$this->assertEqual($view->generateHandlerId('test', $test_ids), 'test_2');
// Test the getPath() method.
$path = $this->randomName();
......
......@@ -257,11 +257,11 @@ protected function displayMethodTests() {
$display_id = 'default';
$expected_items = array();
// Tests addItem with getItem.
// Tests addHandler with getItem.
// Therefore add one item without any optioins and one item with some
// options.
$id1 = $view->addItem($display_id, 'field', 'views_test_data', 'id');
$item1 = $view->getItem($display_id, 'field', 'id');
$id1 = $view->addHandler($display_id, 'field', 'views_test_data', 'id');
$item1 = $view->getHandler($display_id, 'field', 'id');
$expected_items[$id1] = $expected_item = array(
'id' => 'id',
'table' => 'views_test_data',
......@@ -276,8 +276,8 @@ protected function displayMethodTests() {
'text' => $this->randomName()
)
);
$id2 = $view->addItem($display_id, 'field', 'views_test_data', 'name', $options);
$item2 = $view->getItem($display_id, 'field', 'name');
$id2 = $view->addHandler($display_id, 'field', 'views_test_data', 'name', $options);
$item2 = $view->getHandler($display_id, 'field', 'name');
$expected_items[$id2] = $expected_item = array(
'id' => 'name',
'table' => 'views_test_data',
......@@ -288,7 +288,7 @@ protected function displayMethodTests() {
$this->assertEqual($item2, $expected_item);
// Tests the expected fields from the previous additions.
$this->assertEqual($view->getItems('field', $display_id), $expected_items);
$this->assertEqual($view->getHandlers('field', $display_id), $expected_items);
// Alter an existing item via setItem and check the result via getItem
// and getItems.
......@@ -298,14 +298,14 @@ protected function displayMethodTests() {
)
) + $item1;
$expected_items[$id1] = $item;
$view->setItem($display_id, 'field', $id1, $item);
$this->assertEqual($view->getItem($display_id, 'field', 'id'), $item);
$this->assertEqual($view->getItems('field', $display_id), $expected_items);
$view->setHandler($display_id, 'field', $id1, $item);
$this->assertEqual($view->getHandler($display_id, 'field', 'id'), $item);
$this->assertEqual($view->getHandlers('field', $display_id), $expected_items);
// Test removeItem method.
unset($expected_items[$id2]);
$view->removeItem($display_id, 'field', $id2);
$this->assertEqual($view->getItems('field', $display_id), $expected_items);
$view->removeHandler($display_id, 'field', $id2);
$this->assertEqual($view->getHandlers('field', $display_id), $expected_items);
}
/**
......
......@@ -1958,14 +1958,14 @@ public static function getPluginTypes() {
* @return string
* The unique ID for this handler instance.
*/
public function addItem($display_id, $type, $table, $field, $options = array(), $id = NULL) {
public function addHandler($display_id, $type, $table, $field, $options = array(), $id = NULL) {
$types = $this::viewsHandlerTypes();
$this->setDisplay($display_id);
$fields = $this->displayHandlers->get($display_id)->getOption($types[$type]['plural']);
if (empty($id)) {
$id = $this->generateItemId($field, $fields);
$id = $this->generateHandlerId($field, $fields);
}
// If the desired type is not found, use the original value directly.
......@@ -2008,7 +2008,7 @@ public function addItem($display_id, $type, $table, $field, $options = array(),
* integer to make it unique, e.g., "{$requested_id}_1",
* "{$requested_id}_2", etc.
*/
public static function generateItemId($requested_id, $existing_items) {
public static function generateHandlerId($requested_id, $existing_items) {
$count = 0;
$id = $requested_id;
while (!empty($existing_items[$id])) {
......@@ -2029,7 +2029,7 @@ public static function generateItemId($requested_id, $existing_items) {
* @return array
* An array of handler instances of a given type for this display.
*/
public function getItems($type, $display_id = NULL) {
public function getHandlers($type, $display_id = NULL) {
$this->setDisplay($display_id);
if (!isset($display_id)) {
......@@ -2055,7 +2055,7 @@ public function getItems($type, $display_id = NULL) {
* Either the handler instance's configuration, or NULL if the handler is
* not used on the display.
*/
public function getItem($display_id, $type, $id) {
public function getHandler($display_id, $type, $id) {
// Get info about the types so we can get the right data.
$types = static::viewsHandlerTypes();
// Initialize the display
......@@ -2081,7 +2081,7 @@ public function getItem($display_id, $type, $id) {
*
* @see set_item_option()
*/
public function setItem($display_id, $type, $id, $item) {
public function setHandler($display_id, $type, $id, $item) {
// Get info about the types so we can get the right data.
$types = static::viewsHandlerTypes();
// Initialize the display.
......@@ -2107,7 +2107,7 @@ public function setItem($display_id, $type, $id, $item) {
* @param string $id
* The ID of the handler being removed.
*/
public function removeItem($display_id, $type, $id) {
public function removeHandler($display_id, $type, $id) {
// Get info about the types so we can get the right data.
$types = static::viewsHandlerTypes();
// Initialize the display.
......@@ -2142,10 +2142,10 @@ public function removeItem($display_id, $type, $id) {
*
* @see set_item()
*/
public function setItemOption($display_id, $type, $id, $option, $value) {
$item = $this->getItem($display_id, $type, $id);
public function setHandlerOption($display_id, $type, $id, $option, $value) {
$item = $this->getHandler($display_id, $type, $id);
$item[$option] = $value;
$this->setItem($display_id, $type, $id, $item);
$this->setHandler($display_id, $type, $id, $item);
}
/**
......
......@@ -164,12 +164,12 @@ Drupal.behaviors.addItemForm = {
attach: function (context) {
var $context = $(context);
var $form = $context;
// The add item form may have an id of views-ui-add-item-form--n.
if (!$context.is('form[id^="views-ui-add-item-form"]')) {
$form = $context.find('form[id^="views-ui-add-item-form"]');
// The add handler form may have an id of views-ui-add-handler-form--n.
if (!$context.is('form[id^="views-ui-add-handler-form"]')) {
$form = $context.find('form[id^="views-ui-add-handler-form"]');
}
if ($form.once('views-ui-add-item-form').length) {
// If we we have an unprocessed views-ui-add-item-form, let's instantiate.
if ($form.once('views-ui-add-handler-form').length) {
// If we we have an unprocessed views-ui-add-handler-form, let's instantiate.
new Drupal.viewsUi.AddItemForm($form);
}
}
......@@ -285,9 +285,9 @@ Drupal.behaviors.viewsUiSearchOptions = {
attach: function (context) {
var $context = $(context);
var $form = $context;
// The add item form may have an id of views-ui-add-item-form--n.
if (!$context.is('form[id^="views-ui-add-item-form"]')) {
$form = $context.find('form[id^="views-ui-add-item-form"]');
// The add handler form may have an id of views-ui-add-handler-form--n.
if (!$context.is('form[id^="views-ui-add-handler-form"]')) {
$form = $context.find('form[id^="views-ui-add-handler-form"]');
}
// Make sure we don't add more than one event handler to the same form.
if ($form.once('views-ui-filter-options').length) {
......@@ -764,7 +764,7 @@ $.extend(Drupal.viewsUi.RearrangeFilterHandler.prototype, {
Drupal.behaviors.viewsFilterConfigSelectAll = {
attach: function (context) {
// Show the select all checkbox.
$(context).find('#views-ui-config-item-form div.form-item-options-value-all').once('filterConfigSelectAll')
$(context).find('#views-ui-handler-form div.form-item-options-value-all').once('filterConfigSelectAll')
.show()
.find('input[type=checkbox]')
.on('click', function () {
......@@ -775,7 +775,7 @@ Drupal.behaviors.viewsFilterConfigSelectAll = {
});
});
// Uncheck the select all checkbox if any of the others are unchecked.
$('#views-ui-config-item-form').find('div.form-type-checkbox').not($('.form-item-options-value-all'))
$('#views-ui-handler-form').find('div.form-type-checkbox').not($('.form-item-options-value-all'))
.find('input[type=checkbox]')
.on('click', function () {
if ($(this).is('checked') === false) {
......
......@@ -103,7 +103,7 @@ public function reportFields() {
foreach ($executable->displayHandlers as $display_id => $display) {
if ($executable->setDisplay($display_id)) {
foreach ($handler_types as $type => $info) {
foreach ($executable->getItems($type, $display_id) as $item) {
foreach ($executable->getHandlers($type, $display_id) as $item) {
$table_data = $this->viewsData->get($item['table']);
if (isset($table_data[$item['field']]) && isset($table_data[$item['field']][$type])
&& $field_data = $table_data[$item['field']][$type]) {
......
......@@ -2,7 +2,7 @@
/**
* @file
* Contains \Drupal\views_ui\Form\Ajax\AddItem.
* Contains \Drupal\views_ui\Form\Ajax\AddHandler.
*/
namespace Drupal\views_ui\Form\Ajax;
......@@ -14,10 +14,10 @@
/**
* Provides a form for adding an item in the Views UI.
*/
class AddItem extends ViewsFormBase {
class AddHandler extends ViewsFormBase {
/**
* Constucts a new AddItem object.
* Constucts a new AddHandler object.
*/
public function __construct($type = NULL) {
$this->setType($type);
......@@ -27,7 +27,7 @@ public function __construct($type = NULL) {
* {@inheritdoc}
*/
public function getFormKey() {
return 'add-item';
return 'add-handler';
}
/**
......@@ -42,7 +42,7 @@ public function getForm(ViewStorageInterface $view, $display_id, $js, $type = NU
* {@inheritdoc}
*/
public function getFormId() {
return 'views_ui_add_item_form';
return 'views_ui_add_handler_form';
}
/**
......@@ -73,7 +73,7 @@ public function buildForm(array $form, array &$form_state) {
}
$form['#title'] = $this->t('Add @type', array('@type' => $ltitle));
$form['#section'] = $display_id . 'add-item';
$form['#section'] = $display_id . 'add-handler';
// Add the display override dropdown.
views_ui_standard_display_dropdown($form, $form_state, $section);
......@@ -171,7 +171,7 @@ public function buildForm(array $form, array &$form_state) {
'data-drupal-views-offset' => 'bottom',
),
);
$view->getStandardButtons($form, $form_state, 'views_ui_add_item_form', $this->t('Add and configure @types', array('@types' => $ltitle)));
$view->getStandardButtons($form, $form_state, 'views_ui_add_handler_form', $this->t('Add and configure @types', array('@types' => $ltitle)));
// Remove the default submit function.
$form['actions']['submit']['#submit'] = array_filter($form['actions']['submit']['#submit'], function($var) {
......
......@@ -2,7 +2,7 @@
/**
* @file
* Contains \Drupal\views_ui\Form\Ajax\ConfigItem.
* Contains \Drupal\views_ui\Form\Ajax\ConfigHandler.
*/
namespace Drupal\views_ui\Form\Ajax;
......@@ -14,10 +14,10 @@
/**
* Provides a form for configuring an item in the Views UI.
*/
class ConfigItem extends ViewsFormBase {
class ConfigHandler extends ViewsFormBase {
/**
* Constucts a new ConfigItem object.
* Constucts a new ConfigHandler object.
*/
public function __construct($type = NULL, $id = NULL) {
$this->setType($type);
......@@ -28,7 +28,7 @@ public function __construct($type = NULL, $id = NULL) {
* {@inheritdoc}
*/
public function getFormKey() {
return 'config-item';
return 'handler';
}
/**
......@@ -66,7 +66,7 @@ public function buildForm(array $form, array &$form_state) {
$executable = $view->getExecutable();
$save_ui_cache = FALSE;
$executable->setDisplay($display_id);
$item = $executable->getItem($display_id, $type, $id);
$item = $executable->getHandler($display_id, $type, $id);
if ($item) {
$handler = $executable->display_handler->getHandler($type, $id);
......@@ -124,7 +124,7 @@ public function buildForm(array $form, array &$form_state) {
$rel = key($relationship_options);
// We want this relationship option to get saved even if the user
// skips submitting the form.
$executable->setItemOption($display_id, $type, $id, 'relationship', $rel);
$executable->setHandlerOption($display_id, $type, $id, 'relationship', $rel);
$save_ui_cache = TRUE;
}
......@@ -239,7 +239,7 @@ public function submitForm(array &$form, array &$form_state) {
$handler->unpackOptions($handler->options, $options, NULL, FALSE);
// Store the item back on the view
$executable->setItem($form_state['display_id'], $form_state['type'], $form_state['id'], $handler->options);
$executable->setHandler($form_state['display_id'], $form_state['type'], $form_state['id'], $handler->options);
// Ensure any temporary options are removed.
if (isset($form_state['view']->temporary_options[$type][$form_state['id']])) {
......@@ -262,7 +262,7 @@ public function remove(&$form, &$form_state) {
$display = &$executable->displayHandlers->get($form_state['display_id']);
$display->optionsOverride($form, $form_state);
}
$executable->removeItem($form_state['display_id'], $form_state['type'], $form_state['id']);
$executable->removeHandler($form_state['display_id'], $form_state['type'], $form_state['id']);
// Write to cache
$form_state['view']->cacheSet();
......
......@@ -2,7 +2,7 @@
/**
* @file
* Contains \Drupal\views_ui\Form\Ajax\ConfigItemExtra.
* Contains \Drupal\views_ui\Form\Ajax\ConfigHandlerExtra.
*/
namespace Drupal\views_ui\Form\Ajax;
......@@ -13,10 +13,10 @@
/**
* Provides a form for configuring extra information for a Views UI item.
*/
class ConfigItemExtra extends ViewsFormBase {
class ConfigHandlerExtra extends ViewsFormBase {
/**
* Constucts a new ConfigItemExtra object.
* Constucts a new ConfigHandlerExtra object.
*/
public function __construct($type = NULL, $id = NULL) {
$this->setType($type);
......@@ -27,7 +27,7 @@ public function __construct($type = NULL, $id = NULL) {
* {@inheritdoc}
*/
public function getFormKey() {
return 'config-item-extra';
return 'handler-extra';
}
/**
......@@ -64,7 +64,7 @@ public function buildForm(array $form, array &$form_state) {
);
$executable = $view->getExecutable();
$executable->setDisplay($display_id);
$item = $executable->getItem($display_id, $type, $id);
$item = $executable->getHandler($display_id, $type, $id);
if ($item) {
$handler = $executable->display_handler->getHandler($type, $id);
......@@ -110,7 +110,7 @@ public function submitForm(array &$form, array &$form_state) {
}
// Store the item back on the view
$form_state['view']->getExecutable()->setItem($form_state['display_id'], $form_sta