diff --git a/core/modules/contextual/contextual.api.php b/core/modules/contextual/contextual.api.php
index d972045..46ce16b 100644
--- a/core/modules/contextual/contextual.api.php
+++ b/core/modules/contextual/contextual.api.php
@@ -18,12 +18,13 @@
* is passed in by reference. Further links may be added or existing links can
* be altered.
*
- * @param $element
+ * @param array $element
* A renderable array representing the contextual links.
- * @param $items
+ * @param array $items
* An associative array containing the original contextual link items, as
* generated by
- * \Drupal\Core\Menu\ContextualLinkManagerInterface::getContextualLinksArrayByGroup(),
+ * \Drupal\Core\Menu\ContextualLinkManagerInterface
+ * ::getContextualLinksArrayByGroup(),
* which were used to build $element['#links'].
*
* @see hook_contextual_links_alter()
diff --git a/core/modules/contextual/contextual.module b/core/modules/contextual/contextual.module
index d9d20b5..e794fc8 100644
--- a/core/modules/contextual/contextual.module
+++ b/core/modules/contextual/contextual.module
@@ -88,7 +88,7 @@ function contextual_help($path, $arg) {
$output .= '
' . t('Displaying contextual links') . '';
$output .= '' . t('Contextual links are supplied by modules, to give you quick access to tasks associated with regions of pages on your site. For instance, if you have a custom menu block displayed in a sidebar of your site, the Blocks and Menus modules will supply links to configure the block and edit the menu. The Contextual Links module collects these links into a list for display by your theme, and also adds JavaScript code to the page to hide the links initially, and display them when your mouse hovers over the block.') . '';
$output .= '';
- return $output;
+ return $output;
}
}
@@ -219,10 +219,10 @@ function contextual_preprocess(&$variables, $hook, $info) {
* contains an identifier ("contextual id"), which allows the JavaScript of the
* drupal.contextual-links library to dynamically render contextual links.
*
- * @param $element
+ * @param array $element
* A structured array with #id containing a "contextual id".
*
- * @return
+ * @return array
* The passed-in element with a contextual link placeholder in '#markup'.
*
* @see _contextual_links_to_id()
@@ -236,7 +236,7 @@ function contextual_pre_render_placeholder($element) {
/**
* Pre-render callback: Builds a renderable array for contextual links.
*
- * @param $element
+ * @param array $element
* A renderable array containing a #contextual_links property, which is a
* keyed array. Each key is the name of the group of contextual links to
* render (based on the 'group' key in the *.contextual_links.yml files for
@@ -255,7 +255,7 @@ function contextual_pre_render_placeholder($element) {
* ))
* @endcode
*
- * @return
+ * @return array
* A renderable array representing contextual links.
*
* @see contextual_element_info()
@@ -264,7 +264,7 @@ function contextual_pre_render_links($element) {
// Retrieve contextual menu links.
$items = array();
- /** @var $contextual_links_manager \Drupal\Core\Menu\ContextualLinkManager */
+ // @var $contextual_links_manager \Drupal\Core\Menu\ContextualLinkManager
$contextual_links_manager = \Drupal::service('plugin.manager.menu.contextual_link');
foreach ($element['#contextual_links'] as $group => $args) {
$args += array(
@@ -317,7 +317,8 @@ function contextual_contextual_links_view_alter(&$element, $items) {
*
* Examples:
* - node:node=1:
- * - views_ui_edit:view=frontpage:location=page&view_name=frontpage&view_display_id=page_1
+ * - views_ui_edit:view=frontpage:location=page&view_name=frontpage
+ * &view_display_id=page_1
* - menu:menu=tools:|block:block=bartik.tools:
*
* So, expressed in a pattern:
diff --git a/core/modules/contextual/contextual.views.inc b/core/modules/contextual/contextual.views.inc
index 528b3bb..7fff5fd 100644
--- a/core/modules/contextual/contextual.views.inc
+++ b/core/modules/contextual/contextual.views.inc
@@ -12,8 +12,6 @@ function contextual_views_data_alter(&$data) {
$data['views']['contextual_links'] = array(
'title' => t('Contextual Links'),
'help' => t('Display fields in a contextual links menu.'),
- 'field' => array(
- 'id' => 'contextual_links',
- ),
+ 'field' => array('id' => 'contextual_links'),
);
}
diff --git a/core/modules/contextual/lib/Drupal/contextual/Plugin/views/field/ContextualLinks.php b/core/modules/contextual/lib/Drupal/contextual/Plugin/views/field/ContextualLinks.php
index 3a14cb1..9a0ffe5 100644
--- a/core/modules/contextual/lib/Drupal/contextual/Plugin/views/field/ContextualLinks.php
+++ b/core/modules/contextual/lib/Drupal/contextual/Plugin/views/field/ContextualLinks.php
@@ -27,6 +27,9 @@ public function usesGroupBy() {
return FALSE;
}
+ /**
+ * Defines options.
+ */
protected function defineOptions() {
$options = parent::defineOptions();
@@ -36,6 +39,9 @@ protected function defineOptions() {
return $options;
}
+ /**
+ * Builds the Options Form.
+ */
public function buildOptionsForm(&$form, &$form_state) {
$all_fields = $this->view->display_handler->getFieldLabels();
// Offer to include only those fields that follow this one.
@@ -116,8 +122,8 @@ public function render(ResultRow $values) {
array(),
array(
'contextual-views-field-links' => drupal_encode_path(drupal_json_encode($links)),
- )
- )
+ ),
+ ),
);
$element = array(
diff --git a/core/modules/contextual/lib/Drupal/contextual/Tests/ContextualDynamicContextTest.php b/core/modules/contextual/lib/Drupal/contextual/Tests/ContextualDynamicContextTest.php
index de44610..094c187 100644
--- a/core/modules/contextual/lib/Drupal/contextual/Tests/ContextualDynamicContextTest.php
+++ b/core/modules/contextual/lib/Drupal/contextual/Tests/ContextualDynamicContextTest.php
@@ -22,6 +22,9 @@ class ContextualDynamicContextTest extends WebTestBase {
*/
public static $modules = array('contextual', 'node', 'views', 'views_ui');
+ /**
+ * Gets info about the test.
+ */
public static function getInfo() {
return array(
'name' => 'Contextual links on node lists',
@@ -30,6 +33,9 @@ public static function getInfo() {
);
}
+ /**
+ * Sets up the test.
+ */
function setUp() {
parent::setUp();
@@ -119,18 +125,21 @@ function testDifferentPermissions() {
* A contextual link id.
*
* @return bool
+ * Boolean from the assertion.
*/
protected function assertContextualLinkPlaceHolder($id) {
$this->assertRaw(' $id)) . '>
', format_string('Contextual link placeholder with id @id exists.', array('@id' => $id)));
}
/**
- * Asserts that a contextual link placeholder with the given id does not exist.
+ * Asserts that a contextual link placeholder with the given id does
+ * not exist.
*
* @param string $id
* A contextual link id.
*
* @return bool
+ * Boolean from the assertion.
*/
protected function assertNoContextualLinkPlaceHolder($id) {
$this->assertNoRaw(' $id)) . '>
', format_string('Contextual link placeholder with id @id does not exist.', array('@id' => $id)));
diff --git a/core/modules/contextual/lib/Drupal/contextual/Tests/ContextualUnitTest.php b/core/modules/contextual/lib/Drupal/contextual/Tests/ContextualUnitTest.php
index 738f047..185b3a1 100644
--- a/core/modules/contextual/lib/Drupal/contextual/Tests/ContextualUnitTest.php
+++ b/core/modules/contextual/lib/Drupal/contextual/Tests/ContextualUnitTest.php
@@ -13,6 +13,9 @@
* Tests _contextual_links_to_id() & _contextual_id_to_links().
*/
class ContextualUnitTest extends DrupalUnitTestBase {
+ /**
+ * Gets info about the test.
+ */
public static function getInfo() {
return array(
'name' => 'Conversion to and from "contextual id"s (for placeholders)',
@@ -24,7 +27,7 @@ public static function getInfo() {
/**
* Provides testcases for testContextualLinksToId() and
*/
- function _contextual_links_id_testcases() {
+ function testCases() {
// Test branch conditions:
// - one group.
// - one dynamic path argument.
@@ -32,10 +35,8 @@ function _contextual_links_id_testcases() {
$tests[] = array(
'links' => array(
'node' => array(
- 'route_parameters' => array(
- 'node' => '14031991',
- ),
- 'metadata' => array()
+ 'route_parameters' => array('node' => '14031991'),
+ 'metadata' => array(),
),
),
'id' => 'node:node=14031991:',
@@ -49,9 +50,9 @@ function _contextual_links_id_testcases() {
'links' => array(
'foo' => array(
'route_parameters'=> array(
- 'bar',
+ 0 => 'bar',
'key' => 'baz',
- 'qux',
+ 1 => 'qux',
),
'metadata' => array(),
),
@@ -66,9 +67,7 @@ function _contextual_links_id_testcases() {
$tests[] = array(
'links' => array(
'views_ui_edit' => array(
- 'route_parameters' => array(
- 'view' => 'frontpage'
- ),
+ 'route_parameters' => array('view' => 'frontpage'),
'metadata' => array(
'location' => 'page',
'display' => 'page_1',
@@ -84,16 +83,14 @@ function _contextual_links_id_testcases() {
$tests[] = array(
'links' => array(
'node' => array(
- 'route_parameters' => array(
- 'node' => '14031991',
- ),
+ 'route_parameters' => array('node' => '14031991'),
'metadata' => array(),
),
'foo' => array(
'route_parameters' => array(
- 'bar',
+ 0 =>'bar',
'key' => 'baz',
- 'qux',
+ 1 => 'qux',
),
'metadata' => array(),
),
@@ -112,7 +109,7 @@ function _contextual_links_id_testcases() {
* Tests _contextual_links_to_id().
*/
function testContextualLinksToId() {
- $tests = $this->_contextual_links_id_testcases();
+ $tests = $this->testCases();
foreach ($tests as $test) {
$this->assertIdentical(_contextual_links_to_id($test['links']), $test['id']);
}
@@ -122,7 +119,7 @@ function testContextualLinksToId() {
* Tests _contextual_id_to_links().
*/
function testContextualIdToLinks() {
- $tests = $this->_contextual_links_id_testcases();
+ $tests = $this->testCases();
foreach ($tests as $test) {
$this->assertIdentical(_contextual_id_to_links($test['id']), $test['links']);
}