Commit ebe7d618 authored by webchick's avatar webchick

Issue #2137223 by YesCT: Config translation code documentation and small code clean up.

parent 699918fe
/**
* @file
* Styles for configuration translation.
* Styles for Configuration Translation.
*/
/**
......
......@@ -33,7 +33,7 @@ class ConfigTranslationOverviewAccess implements StaticAccessCheckInterface {
protected $sourceLanguage;
/**
* Constructs a ConfigNameCheck object.
* Constructs a ConfigTranslationOverviewAccess object.
*
* @param \Drupal\config_translation\ConfigMapperManagerInterface $config_mapper_manager
* The mapper plugin discovery service.
......
......@@ -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 {
/**
* Configuration mapper manager.
* The configuration 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 couldn't be matched.
* A populated request object or NULL if the patch could not be matched.
*/
protected function getRequestForPath(Request $request, $path) {
// @todo Use RequestHelper::duplicate once https://drupal.org/node/2090293
......
......@@ -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 EntityListController object.
* Constructs a new ConfigTranslationFieldInstanceListController 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) {
......
......@@ -19,7 +19,7 @@
class ConfigTranslationListController extends ControllerBase implements ContainerInjectionInterface {
/**
* Definition of the config mapper.
* The definition 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) {
......
......@@ -28,7 +28,7 @@ class ConfigTranslationMapperList extends ControllerBase implements ContainerInj
protected $mappers;
/**
* Constructs a new ConfigTranslationMapperIndex object.
* Constructs a new ConfigTranslationMapperList 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(
......
......@@ -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;
......
......@@ -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)));
}
}
......@@ -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;
/**
* String translation storage object.
* The string 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) {
......
......@@ -8,7 +8,7 @@
namespace Drupal\config_translation\FormElement;
/**
* Base class for form elements.
* Defines a base class for form elements.
*/
abstract class Element implements ElementInterface {
......
......@@ -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;
/**
......
......@@ -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) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment