Commit 395d3a6b authored by Dries's avatar Dries
Browse files

Merge branch '8.x' of git.drupal.org:project/drupal into 8.x

parents ecb40367 92130d26
......@@ -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'),
);
}
......
......@@ -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')) {
......
......@@ -31,7 +31,7 @@ public function getFormID();
* @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 @@ public function build(array $form, array &$form_state);
* @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 @@ public function validate(array &$form, array &$form_state);
* @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);
}
......@@ -100,11 +100,11 @@ public function getFormID() {
}
/**
* 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 @@ public function build(array $form, array &$form_state) {
}
/**
* 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']);
......
......@@ -39,9 +39,9 @@ public function getFormID() {
}
/**
* 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 @@ public function build(array $form, array &$form_state) {
}
/**
* 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);
......
......@@ -50,9 +50,9 @@ public function getFormID() {
}
/**
* 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 @@ public function build(array $form, array &$form_state) {
}
/**
* 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 @@ public function validate(array &$form, array &$form_state) {
* @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 @@ protected function validateAddExisting(array $form, array &$form_state) {
}
/**
* 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);
......
......@@ -61,15 +61,15 @@ public function __construct($entity_type, $bundle, $view_mode = NULL) {
}
/**
* 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) {
}
/**
......
<?php
/**
* @file
* Contains \Drupal\node\Tests\Views\RowPluginTest.
*/
namespace Drupal\node\Tests\Views;
/**
* Tests the node row plugin.
*
* @see \Drupal\node\Plugin\views\row\NodeRow
*/
class RowPluginTest extends NodeTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('node', 'comment');
/**
* Views used by this test.
*
* @var array
*/
public static $testViews = array('test_node_row_plugin');
/**
* Contains all comments keyed by node used by the test.
*
* @var array
*/
protected $comments;
/**
* Contains all nodes used by this test.
*
* @var array
*/
protected $nodes;
public static function getInfo() {
return array(
'name' => '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.');
}
}
}
}
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
......@@ -34,12 +34,12 @@ public static function getInfo() {
*/
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.');
}
}
......@@ -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';
......
......@@ -22,10 +22,10 @@ public function getFormID() {
}
/**
* 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 @@ public function build(array $form, array &$form_state) {
}
/**
* 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.'));
}
}
......@@ -77,7 +77,7 @@ function render($values) {
* 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();
......
......@@ -29,7 +29,7 @@ public function render_link(EntityInterface $entity, \stdClass $values) {
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';
......
......@@ -29,7 +29,7 @@ public function render_link(EntityInterface $entity, \stdClass $values) {
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';
......
......@@ -45,7 +45,7 @@ function testUserAdmin() {
$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'.
......
......@@ -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,
);
......
......@@ -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;