Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / modules / contrib / devel / devel.module
index 1b37d13b568d3c16004a5ca83154f8d9e76e9df3..08b93e22f36587f5e53004f50e37745f8ca11981 100644 (file)
@@ -26,6 +26,7 @@ use Drupal\Core\Url;
 use Drupal\Core\Utility\Error;
 use Drupal\devel\EntityTypeInfo;
 use Drupal\devel\ToolbarHandler;
+use Drupal\Core\StringTranslation\TranslatableMarkup;
 
 /**
  * Implements hook_help().
@@ -74,6 +75,11 @@ function devel_help($route_name, RouteMatchInterface $route_match) {
     case 'devel.state_system_page':
       return '<p>' . t('This is a list of state variables and their values. For more information read online documentation of <a href=":documentation">State API in Drupal 8</a>.', array(':documentation' => "https://www.drupal.org/developing/api/8/state")) . '</p>';
 
+    case 'devel.layout_info':
+      $output = '';
+      $output .= '<p>' . t('Displays layouts available to the site. For a complete overview of the layout system, see the <a href=":url">Layout API documentation</a>.', [':url' => 'https://www.drupal.org/docs/8/api/layout-api']) . '</p>';
+      return $output;
+
   }
 }
 
@@ -104,6 +110,21 @@ function devel_toolbar() {
     ->toolbar();
 }
 
+/**
+ * Implements hook_menu_links_discovered_alter().
+ */
+function devel_menu_links_discovered_alter(&$links) {
+  // Conditionally add the Layouts info menu link.
+  if (\Drupal::moduleHandler()->moduleExists('layout_discovery')) {
+    $links['devel.layout_info'] = [
+      'title' => new TranslatableMarkup('Layouts Info'),
+      'route_name' => 'devel.layout_info',
+      'description' => new TranslatableMarkup('Overview of layouts available to the site.'),
+      'menu_name' => 'devel',
+    ];
+  }
+}
+
 /**
  * Implements hook_local_tasks_alter().
  */
@@ -531,46 +552,6 @@ function ddebug_backtrace($return = FALSE, $pop = 0, $options = DEBUG_BACKTRACE_
   }
 }
 
-/*
- * Migration-related functions.
- */
-
-/**
- * Regenerates the data in node_comment_statistics table.
- * Technique - http://www.artfulsoftware.com/infotree/queries.php?&bw=1280#101
- *
- * @return void
- */
-function devel_rebuild_node_comment_statistics() {
-  // Empty table.
-  db_truncate('node_comment_statistics')->execute();
-
-  // TODO: DBTNG. Ignore keyword is Mysql only? Is only used in the rare case
-  // when two comments on the same node share same timestamp.
-  $sql = "
-    INSERT IGNORE INTO {node_comment_statistics} (nid, cid, last_comment_timestamp, last_comment_name, last_comment_uid, comment_count) (
-      SELECT c.nid, c.cid, c.created, c.name, c.uid, c2.comment_count FROM {comment} c
-      JOIN (
-        SELECT c.nid, MAX(c.created) AS created, COUNT(*) AS comment_count FROM {comment} c WHERE status = 1 GROUP BY c.nid
-      ) AS c2 ON c.nid = c2.nid AND c.created = c2.created
-    )";
-  db_query($sql, array(':published' => CommentInterface::PUBLISHED));
-
-  // Insert records into the node_comment_statistics for nodes that are missing.
-  $query = db_select('node', 'n');
-  $query->leftJoin('node_comment_statistics', 'ncs', 'ncs.nid = n.nid');
-  $query->addField('n', 'changed', 'last_comment_timestamp');
-  $query->addField('n', 'uid', 'last_comment_uid');
-  $query->addField('n', 'nid');
-  $query->addExpression('0', 'comment_count');
-  $query->addExpression('NULL', 'last_comment_name');
-  $query->isNull('ncs.comment_count');
-
-  db_insert('node_comment_statistics', array('return' => Database::RETURN_NULL))
-    ->from($query)
-    ->execute();
-}
-
 /**
  * Implements hook_form_FORM_ID_alter().
  *