Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
drupalorg
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupalorg
Merge requests
!335
3506170 : Add "Submit issue about docs" to Drupal CMS docs pages
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
3506170 : Add "Submit issue about docs" to Drupal CMS docs pages
issue/drupalorg-3506170:3506170-add-submit-issue
into
1.0.x
Overview
14
Commits
9
Pipelines
11
Changes
3
Merged
Brendan Blaine
requested to merge
issue/drupalorg-3506170:3506170-add-submit-issue
into
1.0.x
1 month ago
Overview
14
Commits
9
Pipelines
11
Changes
3
Expand
Closes
#3506170
0
0
Merge request reports
Compare
1.0.x
version 10
797f7327
1 month ago
version 9
013f19d7
1 month ago
version 8
0fa981bf
1 month ago
version 7
1593c19d
1 month ago
version 6
1d8f1aef
1 month ago
version 5
42f1fdbc
1 month ago
version 4
197c7fe7
1 month ago
version 3
b16b8b5a
1 month ago
version 2
97d2c10a
1 month ago
version 1
f8686f6a
1 month ago
1.0.x (base)
and
latest version
latest version
797f7327
9 commits,
1 month ago
version 10
797f7327
9 commits,
1 month ago
version 9
013f19d7
8 commits,
1 month ago
version 8
0fa981bf
7 commits,
1 month ago
version 7
1593c19d
6 commits,
1 month ago
version 6
1d8f1aef
5 commits,
1 month ago
version 5
42f1fdbc
4 commits,
1 month ago
version 4
197c7fe7
3 commits,
1 month ago
version 3
b16b8b5a
2 commits,
1 month ago
version 2
97d2c10a
1 commit,
1 month ago
version 1
f8686f6a
1 commit,
1 month ago
3 files
+
116
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
src/Plugin/Block/DrupalOrgDocumentationIssue.php
0 → 100644
+
90
−
0
Options
<?php
namespace
Drupal\drupalorg\Plugin\Block
;
use
Drupal\Core\Url
;
use
Drupal\Core\Block\BlockBase
;
use
Drupal\Core\Routing\RouteMatchInterface
;
use
Drupal\Core\Plugin\ContainerFactoryPluginInterface
;
use
Symfony\Component\DependencyInjection\ContainerInterface
;
/**
* Provides a 'DrupalOrg Documentation Issue Submission' Block.
*
* @Block(
* id = "drupalorg_documentation_issue_submission",
* admin_label = @Translation("DrupalOrg Documentation Issue Submission")
* )
*/
class
DrupalOrgDocumentationIssue
extends
BlockBase
implements
ContainerFactoryPluginInterface
{
/**
* The current route match.
*
* @var \Drupal\Core\Routing\RouteMatchInterface
*/
protected
RouteMatchInterface
$routeMatch
;
/**
* Constructs a new DrupalOrgDocumentationIssue instance.
*
* @param array $configuration
* A configuration array containing information about the plugin instance.
* @param string $plugin_id
* The plugin_id for the plugin instance.
* @param mixed $plugin_definition
* The plugin implementation definition.
* @param \Drupal\Core\Routing\RouteMatchInterface $route_match
* The current route match.
*/
public
function
__construct
(
array
$configuration
,
$plugin_id
,
$plugin_definition
,
RouteMatchInterface
$route_match
)
{
parent
::
__construct
(
$configuration
,
$plugin_id
,
$plugin_definition
);
$this
->
routeMatch
=
$route_match
;
}
/**
* {@inheritdoc}
*/
public
static
function
create
(
ContainerInterface
$container
,
array
$configuration
,
$plugin_id
,
$plugin_definition
)
{
return
new
static
(
$configuration
,
$plugin_id
,
$plugin_definition
,
$container
->
get
(
'current_route_match'
)
);
}
/**
* {@inheritdoc}
*/
public
function
build
()
{
$node
=
$this
->
routeMatch
->
getParameter
(
'node'
);
if
(
$node
&&
$node
->
bundle
()
==
'documentation'
)
{
$node_title
=
$node
->
getTitle
();
$formatted_title
=
sprintf
(
'Suggestion for: %s'
,
$node_title
);
// Get the absolute URL of the current node.
$node_url
=
$node
->
toUrl
()
->
setAbsolute
()
->
toString
();
$url
=
Url
::
fromUri
(
'https://www.drupal.org/node/add/project-issue/documentation'
,
[
'query'
=>
[
'title'
=>
$formatted_title
,
'body'
=>
'The documentation can be found at: '
.
$node_url
,
],
]);
return
[
'#theme'
=>
'drupalorg_documentation_issue_submission'
,
'#url'
=>
$url
->
toString
(),
];
}
return
[];
}
}
Loading