Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
ebe7d618
Commit
ebe7d618
authored
Nov 22, 2013
by
webchick
Browse files
Issue
#2137223
by YesCT: Config translation code documentation and small code clean up.
parent
699918fe
Changes
12
Hide whitespace changes
Inline
Side-by-side
core/modules/config_translation/css/config_translation.admin.css
View file @
ebe7d618
/**
* @file
* Styles for
c
onfiguration
t
ranslation.
* Styles for
C
onfiguration
T
ranslation.
*/
/**
...
...
core/modules/config_translation/lib/Drupal/config_translation/Access/ConfigTranslationOverviewAccess.php
View file @
ebe7d618
...
...
@@ -33,7 +33,7 @@ class ConfigTranslationOverviewAccess implements StaticAccessCheckInterface {
protected
$sourceLanguage
;
/**
* Constructs a Config
NameCheck
object.
* Constructs a Config
TranslationOverviewAccess
object.
*
* @param \Drupal\config_translation\ConfigMapperManagerInterface $config_mapper_manager
* The mapper plugin discovery service.
...
...
core/modules/config_translation/lib/Drupal/config_translation/Controller/ConfigTranslationController.php
View file @
ebe7d618
...
...
@@ -9,8 +9,8 @@
use
Drupal\config_translation
\
ConfigMapperManagerInterface
;
use
Drupal\Core\Access\AccessManager
;
use
Drupal\Core\DependencyInjection\ContainerInjectionInterface
;
use
Drupal\Core\Controller\ControllerBase
;
use
Drupal\Core\DependencyInjection\ContainerInjectionInterface
;
use
Drupal\Core\Language\Language
;
use
Drupal\Core\PathProcessor\InboundPathProcessorInterface
;
use
Drupal\Core\Session\AccountInterface
;
...
...
@@ -20,7 +20,6 @@
use
Symfony\Component\HttpKernel\Exception\NotFoundHttpException
;
use
Symfony\Component\Routing\Exception\ResourceNotFoundException
;
use
Symfony\Component\Routing\Matcher\RequestMatcherInterface
;
use
Symfony\Component\Routing\Route
;
/**
* Provides page callbacks for the configuration translation interface.
...
...
@@ -28,7 +27,7 @@
class
ConfigTranslationController
extends
ControllerBase
implements
ContainerInjectionInterface
{
/**
*
C
onfiguration mapper manager.
*
The c
onfiguration mapper manager.
*
* @var \Drupal\config_translation\ConfigMapperManagerInterface
*/
...
...
@@ -144,8 +143,8 @@ public function itemPage(Request $request, $plugin_id) {
foreach
(
$languages
as
$language
)
{
$langcode
=
$language
->
id
;
// This is needed because
e.g.
// ConfigMapperInterface::getAddRouteParameters()
// This is needed because
// ConfigMapperInterface::getAddRouteParameters()
, for example,
// needs to return the correct language code for each table row.
$fake_request
->
attributes
->
set
(
'langcode'
,
$langcode
);
$mapper
->
populateFromRequest
(
$fake_request
);
...
...
@@ -227,7 +226,7 @@ public function itemPage(Request $request, $plugin_id) {
* Path to look up.
*
* @return \Symfony\Component\HttpFoundation\Request|null
* A populated request object or NULL if the patch could
n'
t be matched.
* A populated request object or NULL if the patch could
no
t be matched.
*/
protected
function
getRequestForPath
(
Request
$request
,
$path
)
{
// @todo Use RequestHelper::duplicate once https://drupal.org/node/2090293
...
...
core/modules/config_translation/lib/Drupal/config_translation/Controller/ConfigTranslationFieldInstanceListController.php
View file @
ebe7d618
...
...
@@ -31,14 +31,14 @@ class ConfigTranslationFieldInstanceListController extends ConfigTranslationEnti
/**
* An array containing the base entity type's definition.
*
* @var
string
* @var
array
*/
protected
$baseEntityInfo
=
array
();
/**
* The bundle info for the base entity type.
*
* @var
string
* @var
array
*/
protected
$baseEntityBundles
=
array
();
...
...
@@ -59,7 +59,7 @@ class ConfigTranslationFieldInstanceListController extends ConfigTranslationEnti
* @param array $entity_info
* An array of entity info for the entity type.
* @param array $definition
* The plugin definition of the config translation mapper.
*
(optional)
The plugin definition of the config translation mapper.
*
* @return static
* A new instance of the entity controller.
...
...
@@ -76,7 +76,7 @@ public static function createInstance(ContainerInterface $container, $entity_typ
}
/**
* Constructs a new
Entity
ListController object.
* Constructs a new
ConfigTranslationFieldInstance
ListController object.
*
* @param string $entity_type
* The type of entity to be listed.
...
...
@@ -88,7 +88,7 @@ public static function createInstance(ContainerInterface $container, $entity_typ
* The module handler to invoke hooks on.
* @param \Drupal\Core\Entity\EntityManager $entity_manager
* The entity manager.
* @param $definition
* @param
array
$definition
* The plugin definition of the config translation mapper.
*/
public
function
__construct
(
$entity_type
,
array
$entity_info
,
EntityStorageControllerInterface
$storage
,
ModuleHandlerInterface
$module_handler
,
EntityManager
$entity_manager
,
array
$definition
)
{
...
...
core/modules/config_translation/lib/Drupal/config_translation/Controller/ConfigTranslationListController.php
View file @
ebe7d618
...
...
@@ -19,7 +19,7 @@
class
ConfigTranslationListController
extends
ControllerBase
implements
ContainerInjectionInterface
{
/**
*
D
efinition of the config mapper.
*
The d
efinition of the config mapper.
*
* @var array
*/
...
...
@@ -37,7 +37,7 @@ class ConfigTranslationListController extends ControllerBase implements Containe
*
* @param \Drupal\config_translation\ConfigMapperManagerInterface $mapper_manager
* The config mapper manager.
* @param $config_translation_mapper
* @param
string
$config_translation_mapper
* The config mapper id.
*/
public
function
__construct
(
ConfigMapperManagerInterface
$mapper_manager
,
$config_translation_mapper
)
{
...
...
core/modules/config_translation/lib/Drupal/config_translation/Controller/ConfigTranslationMapperList.php
View file @
ebe7d618
...
...
@@ -28,7 +28,7 @@ class ConfigTranslationMapperList extends ControllerBase implements ContainerInj
protected
$mappers
;
/**
* Constructs a new ConfigTranslationMapper
Index
object.
* Constructs a new ConfigTranslationMapper
List
object.
*
* @param \Drupal\config_translation\ConfigMapperInterface[] $mappers
* The configuration mapper manager.
...
...
@@ -38,7 +38,7 @@ public function __construct(array $mappers) {
}
/**
* {inheritdoc}
* {
@
inheritdoc}
*/
public
static
function
create
(
ContainerInterface
$container
)
{
return
new
static
(
...
...
core/modules/config_translation/lib/Drupal/config_translation/Form/ConfigTranslationDeleteForm.php
View file @
ebe7d618
...
...
@@ -7,13 +7,11 @@
namespace
Drupal\config_translation\Form
;
use
Drupal\config_translation
\
ConfigMapperInterface
;
use
Drupal\config_translation
\
ConfigMapperManagerInterface
;
use
Drupal\Core\Cache\Cache
;
use
Drupal\Core\Config\StorageInterface
;
use
Drupal\Core\Extension\ModuleHandlerInterface
;
use
Drupal\Core\Form\ConfirmFormBase
;
use
Drupal\Core\Language\Language
;
use
Symfony\Component\DependencyInjection\ContainerInterface
;
use
Symfony\Component\HttpFoundation\Request
;
use
Symfony\Component\HttpKernel\Exception\NotFoundHttpException
;
...
...
core/modules/config_translation/lib/Drupal/config_translation/Form/ConfigTranslationEditForm.php
View file @
ebe7d618
...
...
@@ -40,4 +40,5 @@ public function submitForm(array &$form, array &$form_state) {
parent
::
submitForm
(
$form
,
$form_state
);
drupal_set_message
(
$this
->
t
(
'Successfully updated @language translation.'
,
array
(
'@language'
=>
$this
->
language
->
name
)));
}
}
core/modules/config_translation/lib/Drupal/config_translation/Form/ConfigTranslationFormBase.php
View file @
ebe7d618
...
...
@@ -7,7 +7,6 @@
namespace
Drupal\config_translation\Form
;
use
Drupal\config_translation
\
ConfigMapperInterface
;
use
Drupal\config_translation
\
ConfigMapperManagerInterface
;
use
Drupal\Core\Config\Config
;
use
Drupal\Core\Config\Schema\Element
;
...
...
@@ -41,7 +40,7 @@ abstract class ConfigTranslationFormBase extends FormBase implements BaseFormIdI
protected
$configMapperManager
;
/**
*
S
tring translation storage object.
*
The s
tring translation storage object.
*
* @var \Drupal\locale\StringStorageInterface
*/
...
...
@@ -114,7 +113,7 @@ public static function create(ContainerInterface $container) {
}
/**
* {@inheritdoc}
.
* {@inheritdoc}
*/
public
function
getBaseFormID
()
{
return
'config_translation_form'
;
...
...
@@ -131,11 +130,12 @@ public function getBaseFormID() {
* @param array $form_state
* An associative array containing the current state of the form.
* @param \Symfony\Component\HttpFoundation\Request $request
* Page request object.
*
(optional)
Page request object.
* @param string $plugin_id
* The plugin ID of the mapper.
*
(optional)
The plugin ID of the mapper.
* @param string $langcode
* The language code of the language the form is adding or editing.
* (optional) The language code of the language the form is adding or
* editing.
*
* @return array
* The form structure.
...
...
@@ -359,8 +359,8 @@ protected function buildConfigForm(Element $schema, $config_data, $base_config_d
* Either format is used, the nested arrays are just containers and not
* needed for saving the data.
* @param bool $shipped_config
* Flag to specify whether the configuration had a shipped
version and
* therefore should also be stored in the locale database.
*
(optional)
Flag to specify whether the configuration had a shipped
*
version and
therefore should also be stored in the locale database.
*/
protected
function
setConfig
(
Language
$language
,
Config
$base_config
,
Config
$translation_config
,
array
$config_values
,
$shipped_config
=
FALSE
)
{
foreach
(
$config_values
as
$key
=>
$value
)
{
...
...
core/modules/config_translation/lib/Drupal/config_translation/FormElement/Element.php
View file @
ebe7d618
...
...
@@ -8,7 +8,7 @@
namespace
Drupal\config_translation\FormElement
;
/**
*
B
ase class for form elements.
*
Defines a b
ase class for form elements.
*/
abstract
class
Element
implements
ElementInterface
{
...
...
core/modules/config_translation/lib/Drupal/config_translation/Plugin/Derivative/ConfigTranslationContextualLinks.php
View file @
ebe7d618
...
...
@@ -11,7 +11,6 @@
use
Drupal\Component\Plugin\Derivative\DerivativeBase
;
use
Drupal\config_translation
\
ConfigMapperManagerInterface
;
use
Drupal\Core\Plugin\Discovery\ContainerDerivativeInterface
;
use
Drupal\Core\Routing\RouteProviderInterface
;
use
Symfony\Component\DependencyInjection\ContainerInterface
;
/**
...
...
core/modules/config_translation/lib/Drupal/config_translation/Plugin/Derivative/ConfigTranslationLocalTasks.php
View file @
ebe7d618
...
...
@@ -26,7 +26,7 @@ class ConfigTranslationLocalTasks extends DerivativeBase implements ContainerDer
protected
$mapperManager
;
/**
* The base plugin ID
* The base plugin ID
.
*
* @var string
*/
...
...
@@ -101,7 +101,7 @@ public function alterLocalTasks(array &$local_tasks) {
* @return bool|string
* Returns the local task ID of the parent task, otherwise return FALSE.
*/
protected
function
getTaskFromRoute
(
$route_name
,
&
$local_tasks
)
{
protected
function
getTaskFromRoute
(
$route_name
,
array
&
$local_tasks
)
{
$root_local_task
=
FALSE
;
foreach
(
$local_tasks
as
$plugin_id
=>
$local_task
)
{
if
(
$local_task
[
'route_name'
]
==
$route_name
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment