diff --git a/core/includes/common.inc b/core/includes/common.inc index 99585533d2f..c9077d7e372 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -6327,14 +6327,14 @@ function drupal_parse_info_format($data) { */ function watchdog_severity_levels() { return array( - WATCHDOG_EMERGENCY => t('emergency'), - WATCHDOG_ALERT => t('alert'), - WATCHDOG_CRITICAL => t('critical'), - WATCHDOG_ERROR => t('error'), - WATCHDOG_WARNING => t('warning'), - WATCHDOG_NOTICE => t('notice'), - WATCHDOG_INFO => t('info'), - WATCHDOG_DEBUG => t('debug'), + WATCHDOG_EMERGENCY => t('Emergency'), + WATCHDOG_ALERT => t('Alert'), + WATCHDOG_CRITICAL => t('Critical'), + WATCHDOG_ERROR => t('Error'), + WATCHDOG_WARNING => t('Warning'), + WATCHDOG_NOTICE => t('Notice'), + WATCHDOG_INFO => t('Info'), + WATCHDOG_DEBUG => t('Debug'), ); } diff --git a/core/includes/form.inc b/core/includes/form.inc index 4cdd101ccdc..bba00006b58 100644 --- a/core/includes/form.inc +++ b/core/includes/form.inc @@ -768,7 +768,7 @@ function drupal_retrieve_form($form_id, &$form_state) { $callback = $form_state['build_info']['callback']; } elseif (!empty($form_state['build_info']['callback_object'])) { - $callback = array($form_state['build_info']['callback_object'], 'build'); + $callback = array($form_state['build_info']['callback_object'], 'buildForm'); } // We first check to see if there is a valid form builder callback defined. @@ -1078,7 +1078,7 @@ function drupal_prepare_form($form_id, &$form, &$form_state) { // Ensure that modules can rely on #validate being set. $form['#validate'] = array(); if (isset($form_state['build_info']['callback_object'])) { - $form['#validate'][] = array($form_state['build_info']['callback_object'], 'validate'); + $form['#validate'][] = array($form_state['build_info']['callback_object'], 'validateForm'); } // Check for a handler specific to $form_id. elseif (function_exists($form_id . '_validate')) { @@ -1095,7 +1095,7 @@ function drupal_prepare_form($form_id, &$form, &$form_state) { // Ensure that modules can rely on #submit being set. $form['#submit'] = array(); if (isset($form_state['build_info']['callback_object'])) { - $form['#submit'][] = array($form_state['build_info']['callback_object'], 'submit'); + $form['#submit'][] = array($form_state['build_info']['callback_object'], 'submitForm'); } // Check for a handler specific to $form_id. elseif (function_exists($form_id . '_submit')) { diff --git a/core/lib/Drupal/Core/Form/FormInterface.php b/core/lib/Drupal/Core/Form/FormInterface.php index 2d8864ef4a9..17d721a2d0a 100644 --- a/core/lib/Drupal/Core/Form/FormInterface.php +++ b/core/lib/Drupal/Core/Form/FormInterface.php @@ -31,7 +31,7 @@ interface FormInterface { * @return array * The form structure. */ - public function build(array $form, array &$form_state); + public function buildForm(array $form, array &$form_state); /** * Form validation handler. @@ -41,7 +41,7 @@ interface FormInterface { * @param array $form_state * An associative array containing the current state of the form. */ - public function validate(array &$form, array &$form_state); + public function validateForm(array &$form, array &$form_state); /** * Form submission handler. @@ -51,6 +51,6 @@ interface FormInterface { * @param array $form_state * An associative array containing the current state of the form. */ - public function submit(array &$form, array &$form_state); + public function submitForm(array &$form, array &$form_state); } diff --git a/core/modules/block/lib/Drupal/block/BlockListController.php b/core/modules/block/lib/Drupal/block/BlockListController.php index bde1ce77582..e8f035c182c 100644 --- a/core/modules/block/lib/Drupal/block/BlockListController.php +++ b/core/modules/block/lib/Drupal/block/BlockListController.php @@ -100,11 +100,11 @@ class BlockListController extends ConfigEntityListController implements FormInte } /** - * Implements \Drupal\Core\Form\FormInterface::build(). + * Implements \Drupal\Core\Form\FormInterface::buildForm(). * * Form constructor for the main block administration form. */ - public function build(array $form, array &$form_state) { + public function buildForm(array $form, array &$form_state) { $entities = $this->load(); $form['#attached']['css'][] = drupal_get_path('module', 'block') . '/block.admin.css'; $form['#attached']['library'][] = array('system', 'drupal.tableheader'); @@ -190,18 +190,18 @@ class BlockListController extends ConfigEntityListController implements FormInte } /** - * Implements \Drupal\Core\Form\FormInterface::validate(). + * Implements \Drupal\Core\Form\FormInterface::validateForm(). */ - public function validate(array &$form, array &$form_state) { + public function validateForm(array &$form, array &$form_state) { // No validation. } /** - * Implements \Drupal\Core\Form\FormInterface::submit(). + * Implements \Drupal\Core\Form\FormInterface::submitForm(). * * Form submission handler for the main block administration form. */ - public function submit(array &$form, array &$form_state) { + public function submitForm(array &$form, array &$form_state) { $entities = entity_load_multiple('block', array_keys($form_state['values']['blocks'])); foreach ($entities as $entity_id => $entity) { $entity->set('weight', $form_state['values']['blocks'][$entity_id]['weight']); diff --git a/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverview.php b/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverview.php index 12e6011f29a..7ee40f448a1 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverview.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverview.php @@ -39,9 +39,9 @@ class DisplayOverview extends OverviewBase { } /** - * Implements \Drupal\Core\Form\FormInterface::build(). + * Implements \Drupal\Core\Form\FormInterface::buildForm(). */ - public function build(array $form, array &$form_state) { + public function buildForm(array $form, array &$form_state) { // Gather type information. $instances = field_info_instances($this->entity_type, $this->bundle); $field_types = field_info_field_types(); @@ -407,9 +407,9 @@ class DisplayOverview extends OverviewBase { } /** - * Overrides \Drupal\field_ui\OverviewBase::submit(). + * Overrides \Drupal\field_ui\OverviewBase::submitForm(). */ - public function submit(array &$form, array &$form_state) { + public function submitForm(array &$form, array &$form_state) { $form_values = $form_state['values']; $display = entity_get_display($this->entity_type, $this->bundle, $this->view_mode); diff --git a/core/modules/field_ui/lib/Drupal/field_ui/FieldOverview.php b/core/modules/field_ui/lib/Drupal/field_ui/FieldOverview.php index 136a95197a7..925caef5b40 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/FieldOverview.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/FieldOverview.php @@ -50,9 +50,9 @@ class FieldOverview extends OverviewBase { } /** - * Implements \Drupal\Core\Form\FormInterface::build(). + * Implements \Drupal\Core\Form\FormInterface::buildForm(). */ - public function build(array $form, array &$form_state) { + public function buildForm(array $form, array &$form_state) { // When displaying the form, make sure the list of fields is up-to-date. if (empty($form_state['post'])) { field_info_cache_clear(); @@ -420,9 +420,9 @@ class FieldOverview extends OverviewBase { } /** - * Overrides \Drupal\field_ui\OverviewBase::validate(). + * Implements \Drupal\Core\Form\FormInterface::validateForm(). */ - public function validate(array &$form, array &$form_state) { + public function validateForm(array &$form, array &$form_state) { $this->validateAddNew($form, $form_state); $this->validateAddExisting($form, $form_state); } @@ -435,7 +435,7 @@ class FieldOverview extends OverviewBase { * @param array $form_state * A reference to a keyed array containing the current state of the form. * - * @see Drupal\field_ui\FieldOverview::validate() + * @see Drupal\field_ui\FieldOverview::validateForm() */ protected function validateAddNew(array $form, array &$form_state) { $field = $form_state['values']['fields']['_add_new_field']; @@ -524,9 +524,9 @@ class FieldOverview extends OverviewBase { } /** - * Overrides \Drupal\field_ui\OverviewBase::submit(). + * Overrides \Drupal\field_ui\OverviewBase::submitForm(). */ - public function submit(array &$form, array &$form_state) { + public function submitForm(array &$form, array &$form_state) { $form_values = $form_state['values']['fields']; $bundle_settings = field_bundle_settings($this->entity_type, $this->bundle); diff --git a/core/modules/field_ui/lib/Drupal/field_ui/OverviewBase.php b/core/modules/field_ui/lib/Drupal/field_ui/OverviewBase.php index 9a37e679fef..5a76dc19980 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/OverviewBase.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/OverviewBase.php @@ -61,15 +61,15 @@ abstract class OverviewBase implements FormInterface { } /** - * Implements \Drupal\Core\Form\FormInterface::validate(). + * Implements \Drupal\Core\Form\FormInterface::validateForm(). */ - public function validate(array &$form, array &$form_state) { + public function validateForm(array &$form, array &$form_state) { } /** - * Implements \Drupal\Core\Form\FormInterface::submit(). + * Implements \Drupal\Core\Form\FormInterface::submitForm(). */ - public function submit(array &$form, array &$form_state) { + public function submitForm(array &$form, array &$form_state) { } /** diff --git a/core/modules/node/lib/Drupal/node/Tests/Views/RowPluginTest.php b/core/modules/node/lib/Drupal/node/Tests/Views/RowPluginTest.php deleted file mode 100644 index 6a523ae69ca..00000000000 --- a/core/modules/node/lib/Drupal/node/Tests/Views/RowPluginTest.php +++ /dev/null @@ -1,172 +0,0 @@ - 'Node: Row plugin', - 'description' => 'Tests the node row plugin.', - 'group' => 'Views Modules', - ); - } - - protected function setUp() { - parent::setUp(); - - $this->drupalCreateContentType(array('type' => 'article')); - - // Create two nodes, with 5 comments on all of them. - for ($i = 0; $i < 2; $i++) { - $this->nodes[] = $this->drupalCreateNode( - array( - 'type' => 'article', - 'body' => array( - LANGUAGE_NOT_SPECIFIED => array( - array( - 'value' => $this->randomName(42), - 'format' => filter_default_format(), - 'summary' => $this->randomName(), - ), - ), - ), - ) - ); - } - - foreach ($this->nodes as $node) { - for ($i = 0; $i < 5; $i++) { - $this->comments[$node->id()][] = $this->drupalCreateComment(array('nid' => $node->id())); - } - } - } - - /** - * Helper function to create a random comment. - * - * @param array $settings - * (optional) An associative array of settings for the comment, as used in - * entity_create(). - * - * @return \Drupal\comment\Plugin\Core\Entity\Comment - * Returns the created and saved comment. - */ - public function drupalCreateComment(array $settings = array()) { - $node = node_load($settings['nid']); - $settings += array( - 'subject' => $this->randomName(), - 'node_type' => "comment_node_{$node->bundle()}", - 'comment_body' => $this->randomName(40), - ); - - $comment = entity_create('comment', $settings); - $comment->save(); - return $comment; - } - - /** - * Tests the node row plugin. - */ - public function testRowPlugin() { - $view = views_get_view('test_node_row_plugin'); - $view->initDisplay(); - $view->setDisplay('page'); - $view->initStyle(); - $view->style_plugin->row_plugin->options['view_mode'] = 'full'; - - // Test with view_mode full. - $output = $view->preview(); - foreach ($this->nodes as $node) { - $body = $node->body; - $teaser = $body[LANGUAGE_NOT_SPECIFIED][0]['summary']; - $full = $body[LANGUAGE_NOT_SPECIFIED][0]['value']; - $this->assertFalse(strpos($output, $teaser) !== FALSE, 'Make sure the teaser appears in the output of the view.'); - $this->assertTrue(strpos($output, $full) !== FALSE, 'Make sure the full text appears in the output of the view.'); - } - - // Test with teasers. - $view->style_plugin->row_plugin->options['view_mode'] = 'teaser'; - $output = $view->preview(); - foreach ($this->nodes as $node) { - $body = $node->body; - $teaser = $body[LANGUAGE_NOT_SPECIFIED][0]['summary']; - $full = $body[LANGUAGE_NOT_SPECIFIED][0]['value']; - $this->assertTrue(strpos($output, $teaser) !== FALSE, 'Make sure the teaser appears in the output of the view.'); - $this->assertFalse(strpos($output, $full) !== FALSE, 'Make sure the full text does not appears in the output of the view if teaser is set as viewmode.'); - } - - // Test with links disabled. - $view->style_plugin->row_plugin->options['links'] = FALSE; - $output = $view->preview(); - $this->drupalSetContent($output); - foreach ($this->nodes as $node) { - $this->assertFalse($this->xpath('//li[contains(@class, :class)]/a[contains(@href, :href)]', array(':class' => 'node-readmore', ':href' => "node/{$node->id()}")), 'Make sure no readmore link appears.'); - } - - // Test with links enabled. - $view->style_plugin->row_plugin->options['links'] = TRUE; - $output = $view->preview(); - $this->drupalSetContent($output); - foreach ($this->nodes as $node) { - $this->assertTrue($this->xpath('//li[contains(@class, :class)]/a[contains(@href, :href)]', array(':class' => 'node-readmore', ':href' => "node/{$node->id()}")), 'Make sure no readmore link appears.'); - } - - // Test with comments enabled. - $view->style_plugin->row_plugin->options['comments'] = TRUE; - $output = $view->preview(); - foreach ($this->nodes as $node) { - foreach ($this->comments[$node->id()] as $comment) { - $this->assertTrue(strpos($output, $comment->comment_body->value) !== FALSE, 'Make sure the comment appears in the output.'); - } - } - - // Test with comments disabled. - $view->style_plugin->row_plugin->options['comments'] = FALSE; - $output = $view->preview(); - foreach ($this->nodes as $node) { - foreach ($this->comments[$node->id()] as $comment) { - $this->assertFalse(strpos($output, $comment->comment_body->value) !== FALSE, 'Make sure the comment does not appears in the output when the comments option disabled.'); - } - } - } - -} diff --git a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_row_plugin.yml b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_row_plugin.yml deleted file mode 100644 index f50f97200d4..00000000000 --- a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_row_plugin.yml +++ /dev/null @@ -1,56 +0,0 @@ -base_field: nid -base_table: node -core: 8 -description: '' -status: '1' -display: - default: - display_options: - access: - type: perm - cache: - type: none - exposed_form: - type: basic - filters: - status: - expose: - operator: '0' - field: status - group: '1' - id: status - table: node - value: '1' - plugin_id: boolean - pager: - options: - items_per_page: '10' - type: full - query: - type: views_query - row: - options: - build_mode: teaser - comments: '0' - links: '1' - type: node - sorts: { } - style: - type: default - title: test_node_row_plugin - display_plugin: default - display_title: Master - id: default - position: { } - page: - display_options: - path: test-node-row-plugin - display_plugin: page - display_title: Page - id: page - position: { } -human_name: test_node_row_plugin -langcode: und -module: views -id: test_node_row_plugin -tag: default diff --git a/core/modules/system/lib/Drupal/system/Tests/Form/FormObjectTest.php b/core/modules/system/lib/Drupal/system/Tests/Form/FormObjectTest.php index 9aee405ead4..c35a443a50a 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Form/FormObjectTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Form/FormObjectTest.php @@ -34,12 +34,12 @@ class FormObjectTest extends WebTestBase { */ function testObjectFormCallback() { $this->drupalGet('form-test/object-builder'); - $this->assertText('The FormTestObject::build() method was used for this form.'); + $this->assertText('The FormTestObject::buildForm() method was used for this form.'); $elements = $this->xpath('//form[@id="form-test-form-test-object"]'); $this->assertTrue(!empty($elements), 'The correct form ID was used.'); $this->drupalPost('form-test/object-builder', NULL, t('Save')); - $this->assertText('The FormTestObject::validate() method was used for this form.'); - $this->assertText('The FormTestObject::submit() method was used for this form.'); + $this->assertText('The FormTestObject::validateForm() method was used for this form.'); + $this->assertText('The FormTestObject::submitForm() method was used for this form.'); } } diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 76bc835b2dc..1a659c5e67c 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -3281,7 +3281,7 @@ function system_config_form($form, &$form_state) { if (!isset($form['#submit'])) { $form['#submit'] = array(); if (isset($form_state['build_info']['callback_object'])) { - $form['#submit'][] = array($form_state['build_info']['callback_object'], 'submit'); + $form['#submit'][] = array($form_state['build_info']['callback_object'], 'submitForm'); } elseif (function_exists($form_state['build_info']['form_id'] . '_submit')) { $form['#submit'][] = $form_state['build_info']['form_id'] . '_submit'; diff --git a/core/modules/system/tests/modules/form_test/lib/Drupal/form_test/FormTestObject.php b/core/modules/system/tests/modules/form_test/lib/Drupal/form_test/FormTestObject.php index f3b0cf32898..f08d88e6a61 100644 --- a/core/modules/system/tests/modules/form_test/lib/Drupal/form_test/FormTestObject.php +++ b/core/modules/system/tests/modules/form_test/lib/Drupal/form_test/FormTestObject.php @@ -22,10 +22,10 @@ class FormTestObject implements FormInterface { } /** - * Implements \Drupal\Core\Form\FormInterface::build(). + * Implements \Drupal\Core\Form\FormInterface::buildForm(). */ - public function build(array $form, array &$form_state) { - $form['element'] = array('#markup' => 'The FormTestObject::build() method was used for this form.'); + public function buildForm(array $form, array &$form_state) { + $form['element'] = array('#markup' => 'The FormTestObject::buildForm() method was used for this form.'); $form['actions']['#type'] = 'actions'; $form['actions']['submit'] = array( @@ -36,17 +36,17 @@ class FormTestObject implements FormInterface { } /** - * Implements \Drupal\Core\Form\FormInterface::validate(). + * Implements \Drupal\Core\Form\FormInterface::validateForm(). */ - public function validate(array &$form, array &$form_state) { - drupal_set_message(t('The FormTestObject::validate() method was used for this form.')); + public function validateForm(array &$form, array &$form_state) { + drupal_set_message(t('The FormTestObject::validateForm() method was used for this form.')); } /** - * Implements \Drupal\Core\Form\FormInterface::submit(). + * Implements \Drupal\Core\Form\FormInterface::submitForm(). */ - public function submit(array &$form, array &$form_state) { - drupal_set_message(t('The FormTestObject::submit() method was used for this form.')); + public function submitForm(array &$form, array &$form_state) { + drupal_set_message(t('The FormTestObject::submitForm() method was used for this form.')); } } diff --git a/core/modules/user/lib/Drupal/user/Plugin/views/field/Link.php b/core/modules/user/lib/Drupal/user/Plugin/views/field/Link.php index 8d354c2dc55..6e995b3af0b 100644 --- a/core/modules/user/lib/Drupal/user/Plugin/views/field/Link.php +++ b/core/modules/user/lib/Drupal/user/Plugin/views/field/Link.php @@ -77,7 +77,7 @@ class Link extends FieldPluginBase { * The acutal rendered text (without the link) of this field. */ public function render_link(EntityInterface $entity, \stdClass $values) { - $text = !empty($this->options['text']) ? $this->options['text'] : t('view'); + $text = !empty($this->options['text']) ? $this->options['text'] : t('View'); $this->options['alter']['make_link'] = TRUE; $uri = $entity->uri(); diff --git a/core/modules/user/lib/Drupal/user/Plugin/views/field/LinkCancel.php b/core/modules/user/lib/Drupal/user/Plugin/views/field/LinkCancel.php index 4d6cd274e3a..4e8d96eba11 100644 --- a/core/modules/user/lib/Drupal/user/Plugin/views/field/LinkCancel.php +++ b/core/modules/user/lib/Drupal/user/Plugin/views/field/LinkCancel.php @@ -29,7 +29,7 @@ class LinkCancel extends Link { if ($entity && $entity->access('delete')) { $this->options['alter']['make_link'] = TRUE; - $text = !empty($this->options['text']) ? $this->options['text'] : t('cancel'); + $text = !empty($this->options['text']) ? $this->options['text'] : t('Cancel'); $uri = $entity->uri(); $this->options['alter']['path'] = $uri['path'] . '/cancel'; diff --git a/core/modules/user/lib/Drupal/user/Plugin/views/field/LinkEdit.php b/core/modules/user/lib/Drupal/user/Plugin/views/field/LinkEdit.php index 82931c9ec27..a95767818b3 100644 --- a/core/modules/user/lib/Drupal/user/Plugin/views/field/LinkEdit.php +++ b/core/modules/user/lib/Drupal/user/Plugin/views/field/LinkEdit.php @@ -29,7 +29,7 @@ class LinkEdit extends Link { if ($entity && $entity->access('edit')) { $this->options['alter']['make_link'] = TRUE; - $text = !empty($this->options['text']) ? $this->options['text'] : t('edit'); + $text = !empty($this->options['text']) ? $this->options['text'] : t('Edit'); $uri = $entity->uri(); $this->options['alter']['path'] = $uri['path'] . '/edit'; diff --git a/core/modules/user/lib/Drupal/user/Tests/UserAdminTest.php b/core/modules/user/lib/Drupal/user/Tests/UserAdminTest.php index ef3a1d57529..fa6586038e0 100644 --- a/core/modules/user/lib/Drupal/user/Tests/UserAdminTest.php +++ b/core/modules/user/lib/Drupal/user/Tests/UserAdminTest.php @@ -45,7 +45,7 @@ class UserAdminTest extends WebTestBase { $this->assertText($admin_user->name, 'Found Admin user on admin users page'); // Test for existence of edit link in table. - $link = l(t('edit'), "user/$user_a->uid/edit", array('query' => array('destination' => 'admin/people'))); + $link = l(t('Edit'), "user/$user_a->uid/edit", array('query' => array('destination' => 'admin/people'))); $this->assertRaw($link, 'Found user A edit link on admin users page'); // Filter the users by permission 'administer taxonomy'. diff --git a/core/modules/user/user.admin.inc b/core/modules/user/user.admin.inc index b8f6d421f16..b14118554c0 100644 --- a/core/modules/user/user.admin.inc +++ b/core/modules/user/user.admin.inc @@ -228,13 +228,13 @@ function user_admin_account() { ); $links = array(); $links['edit'] = array( - 'title' => t('edit'), + 'title' => t('Edit'), 'href' => 'user/' . $account->uid . '/edit', 'query' => $destination, ); if (module_invoke('translation_entity', 'translate_access', $account)) { $links['translate'] = array( - 'title' => t('translate'), + 'title' => t('Translate'), 'href' => 'user/' . $account->uid . '/translations', 'query' => $destination, ); @@ -865,12 +865,12 @@ function user_admin_roles($form, $form_state) { '#attributes' => array('class' => array('role-weight')), ); $links['edit'] = array( - 'title' => t('edit role'), + 'title' => t('Edit role'), 'href' => 'admin/people/roles/edit/' . $rid, 'weight' => 0, ); $links['permissions'] = array( - 'title' => t('edit permissions'), + 'title' => t('Edit permissions'), 'href' => 'admin/people/permissions/' . $rid, 'weight' => 5, ); diff --git a/core/modules/views/lib/Drupal/views/Analyzer.php b/core/modules/views/lib/Drupal/views/Analyzer.php index 8021e0d7243..a2ff8ed3dad 100644 --- a/core/modules/views/lib/Drupal/views/Analyzer.php +++ b/core/modules/views/lib/Drupal/views/Analyzer.php @@ -2,11 +2,12 @@ /** * @file - * Definition of Drupal\views\Analyzer. + * Contains \Drupal\views\Analyzer. */ namespace Drupal\views; +use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\views\ViewExecutable; /** @@ -20,44 +21,36 @@ use Drupal\views\ViewExecutable; class Analyzer { /** - * The view to analyze. + * A module handler that invokes the 'views_analyze' hook. * - * @var Drupal\views\ViewExecutable. + * @var \Drupal\Core\Extension\ModuleHandlerInterface */ - protected $view; + protected $moduleHandler; /** - * Constructs the analyzer object. + * Constructs an Analyzer object. * - * @param Drupal\views\ViewExecutable $view - * (optional) The view to analyze. + * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler + * The module handler that invokes the 'views_analyze' hook. */ - function __construct(ViewExecutable $view = NULL) { - if (isset($view)) { - $this->view = $view; - } + public function __construct(ModuleHandlerInterface $module_handler) { + $this->moduleHandler = $module_handler; } - /** - * Sets the view which is analyzed by this analyzer. - * - * @param Drupal\views\ViewExecutable - * The view to analyze. - */ - public function setView(ViewExecutable $view = NULL) { - $this->view = $view; - } /** * Analyzes a review and return the results. * + * @param \Drupal\views\ViewExecutable $view + * The view to analyze. + * * @return array * An array of analyze results organized into arrays keyed by 'ok', * 'warning' and 'error'. */ - public function getMessages() { - $this->view->initDisplay(); - $messages = module_invoke_all('views_analyze', $this->view); + public function getMessages(ViewExecutable $view) { + $view->initDisplay(); + $messages = $this->moduleHandler->invokeAll('views_analyze', array($view)); return $messages; } @@ -70,7 +63,7 @@ class Analyzer { */ public function formatMessages(array $messages) { if (empty($messages)) { - $messages = array($this->formatMessage(t('View analysis can find nothing to report.'), 'ok')); + $messages = array(static::formatMessage(t('View analysis can find nothing to report.'), 'ok')); } $types = array('ok' => array(), 'warning' => array(), 'error' => array()); diff --git a/core/modules/views/lib/Drupal/views/Tests/ViewTestBase.php b/core/modules/views/lib/Drupal/views/Tests/ViewTestBase.php index 4eda92fc004..93685aa1acb 100644 --- a/core/modules/views/lib/Drupal/views/Tests/ViewTestBase.php +++ b/core/modules/views/lib/Drupal/views/Tests/ViewTestBase.php @@ -7,7 +7,6 @@ namespace Drupal\views\Tests; -use DOMDocument; use Drupal\simpletest\WebTestBase; /** diff --git a/core/modules/views/lib/Drupal/views/ViewsBundle.php b/core/modules/views/lib/Drupal/views/ViewsBundle.php index dfb6dd63be6..ac035cb6d93 100644 --- a/core/modules/views/lib/Drupal/views/ViewsBundle.php +++ b/core/modules/views/lib/Drupal/views/ViewsBundle.php @@ -37,6 +37,9 @@ class ViewsBundle extends Bundle { ->addArgument(new Reference('config.factory')); $container->register('views.executable', 'Drupal\views\ViewExecutableFactory'); + + $container->register('views.analyzer', 'Drupal\views\Analyzer') + ->addArgument(new Reference('module_handler')); } } diff --git a/core/modules/views/views.module b/core/modules/views/views.module index b4398f0f78c..8dc5f5a8f79 100644 --- a/core/modules/views/views.module +++ b/core/modules/views/views.module @@ -234,7 +234,6 @@ function views_plugin_list() { * node portion of the theme registry. */ function views_preprocess_node(&$vars) { - module_load_include('inc', 'node', 'node.views'); // The 'view' attribute of the node is added in views_preprocess_node() if (!empty($vars['node']->view) && $vars['node']->view->storage->id()) { $vars['view'] = $vars['node']->view; @@ -251,7 +250,7 @@ function views_preprocess_node(&$vars) { } // Allow to alter comments and links based on the settings in the row plugin. - if (!empty($vars['view']->style_plugin->row_plugin) && $vars['view']->style_plugin->row_plugin->getPluginId() == 'node') { + if (!empty($vars['view']->style_plugin->row_plugin) && get_class($vars['view']->style_plugin->row_plugin) == 'views_plugin_row_node_view') { node_row_node_view_preprocess_node($vars); } } diff --git a/core/modules/views/views_ui/admin.inc b/core/modules/views/views_ui/admin.inc index c4fed07c235..6499fcd927b 100644 --- a/core/modules/views/views_ui/admin.inc +++ b/core/modules/views/views_ui/admin.inc @@ -615,8 +615,8 @@ function views_ui_analyze_view_form($form, &$form_state) { $form['#title'] = t('View analysis'); $form['#section'] = 'analyze'; - $analyzer = new Analyzer($view->get('executable')); - $messages = $analyzer->getMessages(); + $analyzer = drupal_container()->get('views.analyzer'); + $messages = $analyzer->getMessages($view->get('executable')); $form['analysis'] = array( '#prefix' => '
', diff --git a/core/modules/views/views_ui/templates/views-ui-edit-view.tpl.php b/core/modules/views/views_ui/templates/views-ui-edit-view.tpl.php deleted file mode 100644 index d651c4a03cb..00000000000 --- a/core/modules/views/views_ui/templates/views-ui-edit-view.tpl.php +++ /dev/null @@ -1,46 +0,0 @@ - -
- -
- break this lock.', array('!user' => $locked, '!age' => $lock_age, '!break' => $break)); ?> -
- -
"> - vid)): ?> -
- -
- - - @base.', - array('%name' => $view->id(), '@base' => $base_table)); ?> -
- - - -
-
- -
-
- - -
-
- - - -

-
- -
-