Commit 3df4fc00 authored by paulocs's avatar paulocs Committed by paulocs

Issue #3163991 by paulocs: Fix all drupal code standard errors in context/src/Reaction

parent c2a65d51
......@@ -23,9 +23,9 @@ class ContextReaction extends Plugin {
/**
* The human-readable name of the context reaction.
*
* @ingroup plugin_translatable
*
* @var \Drupal\Core\Annotation\Translation
*
* @ingroup plugin_translatable
*/
public $label;
......@@ -34,9 +34,9 @@ class ContextReaction extends Plugin {
*
* This will be shown when adding or configuring this context reaction.
*
* @ingroup plugin_translatable
*
* @var \Drupal\Core\Annotation\Translationoptional
*
* @ingroup plugin_translatable
*/
public $description = '';
......
......@@ -6,22 +6,21 @@ use Drupal\Core\Block\BlockPluginInterface;
use Drupal\Core\Plugin\DefaultLazyPluginCollection;
/**
*
* Provide a Block collection.
*/
class BlockCollection extends DefaultLazyPluginCollection {
/**
* {@inheritdoc}
*
* @return \Drupal\Core\Block\BlockPluginInterface
*/
public function &get($instance_id) {
return parent::get($instance_id);
}
/**
* Returns all blocks keyed by their region. Base code from the ctools block
* plugin collection.
* Returns all blocks keyed by their region.
*
* Base code from the ctools block plugin collection.
*
* @param string $theme
* The theme to get blocks for.
......
......@@ -16,37 +16,49 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request;
/**
*
* The controller for the Block Context Reaction.
*/
class ContextReactionBlocksController extends ControllerBase {
/**
* The block manager.
*
* @var \Drupal\Core\Block\BlockManagerInterface
*/
protected $blockManager;
/**
* The Drupal context repository.
*
* @var \Drupal\Core\Plugin\Context\ContextRepositoryInterface
*/
protected $contextRepository;
/**
* The handler of the available themes.
*
* @var \Drupal\Core\Extension\ThemeHandlerInterface
*/
protected $themeHandler;
/**
* The Context modules context manager.
*
* @var \Drupal\context\ContextManager
*/
protected $contextManager;
/**
* Construct.
* Constructs a new ContextReactionBlocksController object.
*
* @param \Drupal\Core\Block\BlockManagerInterface $blockManager
* The block manager.
* @param \Drupal\Core\Plugin\Context\ContextRepositoryInterface $contextRepository
* The Drupal context repository.
* @param \Drupal\Core\Extension\ThemeHandlerInterface $themeHandler
* The handler of the available themes.
* @param \Drupal\context\ContextManager $contextManager
* The Context modules context manager.
*/
public function __construct(
BlockManagerInterface $blockManager,
......@@ -77,15 +89,14 @@ class ContextReactionBlocksController extends ControllerBase {
*
* @param \Symfony\Component\HttpFoundation\Request $request
* The request object.
*
* @param \Drupal\context\ContextInterface $context
* The context the blocks reaction belongs to.
*
* @param string $reaction_id
* The ID of the blocks reaction that the selected block
* should be added to.
*
* @return array
* Array to build the add block page.
*/
public function blocksLibrary(Request $request, ContextInterface $context, $reaction_id) {
......@@ -184,11 +195,11 @@ class ContextReactionBlocksController extends ControllerBase {
*
* @param \Symfony\Component\HttpFoundation\Request $request
* The current request.
*
* @param \Drupal\context\ContextInterface $context
* The context the block reaction is located on.
*
* @return \Drupal\Core\Ajax\AjaxResponse
* The ajax response.
*/
public function blocksFormThemeSelect(Request $request, ContextInterface $context) {
$theme = $request->request->get('reactions[blocks][theme]', '', TRUE);
......
......@@ -3,7 +3,7 @@
namespace Drupal\context\Reaction\Blocks\Form;
/**
*
* Provides a form to add a block in the Block reaction.
*/
class BlockAddForm extends BlockFormBase {
......
......@@ -12,7 +12,7 @@ use Drupal\Core\Form\FormStateInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
*
* Provides a form to delete a block from block reaction.
*/
class BlockDeleteForm extends ConfirmFormBase {
......@@ -48,6 +48,7 @@ class BlockDeleteForm extends ConfirmFormBase {
* Construct a condition delete form.
*
* @param \Drupal\context\ContextManager $contextManager
* The context manager.
*/
public function __construct(ContextManager $contextManager) {
$this->contextManager = $contextManager;
......@@ -138,6 +139,7 @@ class BlockDeleteForm extends ConfirmFormBase {
* Handle when the form is submitted trough AJAX.
*
* @return \Drupal\Core\Ajax\AjaxResponse
* The ajax response.
*/
public function submitFormAjax() {
$contextForm = $this->contextManager->getForm($this->context, 'edit');
......
......@@ -3,7 +3,7 @@
namespace Drupal\context\Reaction\Blocks\Form;
/**
*
* Provides a form to edit a block in the Block reaction.
*/
class BlockEditForm extends BlockFormBase {
......
......@@ -25,7 +25,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\RequestStack;
/**
*
* Provides a Block Form Base for blocks reactions.
*/
abstract class BlockFormBase extends FormBase {
......@@ -60,31 +60,43 @@ abstract class BlockFormBase extends FormBase {
protected $blockManager;
/**
* The Drupal context repository.
*
* @var \Drupal\Core\Plugin\Context\ContextRepositoryInterface
*/
protected $contextRepository;
/**
* The handler of the available themes.
*
* @var \Drupal\Core\Extension\ThemeHandlerInterface
*/
protected $themeHandler;
/**
* The form builder.
*
* @var \Drupal\Core\Form\FormBuilderInterface
*/
protected $formBuilder;
/**
* The context reaction manager.
*
* @var \Drupal\context\ContextReactionManager
*/
protected $contextReactionManager;
/**
* The Context modules context manager.
*
* @var \Drupal\context\ContextManager
*/
protected $contextManager;
/**
* The current request.
*
* @var \Symfony\Component\HttpFoundation\Request
*/
protected $request;
......@@ -94,14 +106,18 @@ abstract class BlockFormBase extends FormBase {
*
* @param \Drupal\Component\Plugin\PluginManagerInterface $block_manager
* The block manager.
*
* @param \Drupal\Core\Plugin\Context\ContextRepositoryInterface $contextRepository
*
* The Drupal context repository.
* @param \Drupal\Core\Extension\ThemeHandlerInterface $themeHandler
* The handler of the available themes.
* @param \Drupal\Core\Form\FormBuilderInterface $formBuilder
* The form builder.
* @param \Drupal\context\ContextReactionManager $contextReactionManager
* The context reaction manager.
* @param \Drupal\context\ContextManager $contextManager
* The Context modules context manager.
* @param \Symfony\Component\HttpFoundation\RequestStack $requestStack
* The current request.
*/
public function __construct(
PluginManagerInterface $block_manager,
......@@ -151,6 +167,7 @@ abstract class BlockFormBase extends FormBase {
* Get the value to use for the submit button.
*
* @return \Drupal\Core\StringTranslation\TranslatableMarkup
* An object that, when cast to a string, returns the translated string.
*/
abstract protected function getSubmitValue();
......@@ -159,20 +176,17 @@ abstract class BlockFormBase extends FormBase {
*
* @param array $form
* An associative array containing the structure of the form.
*
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The current state of the form.
*
* @param \Drupal\context\ContextInterface $context
* The context the reaction belongs to.
*
* @param string|null $reaction_id
* The ID of the blocks reaction the block should be added to.
*
* @param string|null $block_id
* The ID of the block to show a configuration form for.
*
* @return array
* The form structure.
*/
public function buildForm(array $form, FormStateInterface $form_state, ContextInterface $context = NULL, $reaction_id = NULL, $block_id = NULL) {
$this->context = $context;
......@@ -264,7 +278,6 @@ abstract class BlockFormBase extends FormBase {
*
* @param array $form
* An associative array containing the structure of the form.
*
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The current state of the form.
*/
......@@ -286,7 +299,6 @@ abstract class BlockFormBase extends FormBase {
*
* @param array $form
* An associative array containing the structure of the form.
*
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The current state of the form.
*/
......@@ -332,6 +344,7 @@ abstract class BlockFormBase extends FormBase {
* Handle when the form is submitted trough AJAX.
*
* @return \Drupal\Core\Ajax\AjaxResponse
* An AJAX response.
*/
public function submitFormAjax(array &$form, FormStateInterface $form_state) {
$response = new AjaxResponse();
......@@ -360,11 +373,11 @@ abstract class BlockFormBase extends FormBase {
*
* @param string $theme
* The theme to get a list of regions for.
*
* @param string $show
* What type of regions that should be returned, defaults to all regions.
*
* @return array
* The regions of the theme.
*/
protected function getThemeRegionOptions($theme, $show = BlockRepositoryInterface::REGIONS_ALL) {
$regions = system_region_list($theme, $show);
......
......@@ -7,16 +7,20 @@ use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
/**
*
* Provides a context reaction form base.
*/
abstract class ContextReactionFormBase extends FormBase {
/**
* The context.
*
* @var \Drupal\context\ContextInterface
*/
protected $context;
/**
* The context reaction.
*
* @var \Drupal\context\ContextReactionInterface
*/
protected $reaction;
......@@ -26,17 +30,14 @@ abstract class ContextReactionFormBase extends FormBase {
*
* @param array $form
* An associative array containing the structure of the form.
*
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The current state of the form.
*
* @param \Drupal\context\ContextInterface $context
* The context that contains the reaction.
*
* @param $reaction_id
* @param int $reaction_id
* The id of the reaction that is being configured.
*
* @return array The form structure.
* @return array
* The form structure.
*/
public function buildForm(array $form, FormStateInterface $form_state, ContextInterface $context = NULL, $reaction_id = NULL) {
......
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