Skip to content

Commit

Permalink
Issue #2512708 by slashrsm: Fix minor coding style issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
slashrsm committed Oct 20, 2015
1 parent a8e6602 commit 12372ed
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion entity_browser.api.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function hook_entity_browser_widget_selector_info_alter(&$widgets) {
* name.
*/
function hook_entity_browser_field_widget_display_info_alter(&$field_displays) {
$displays['rendered_entity']['label'] = t('Entity render system FTW');
$field_displays['rendered_entity']['label'] = t('Entity render system FTW');
}

/**
Expand Down
14 changes: 8 additions & 6 deletions src/Ajax/SelectEntitiesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,22 @@ class SelectEntitiesCommand implements CommandInterface {
* @var string
*/
protected $uuid;

/**
* A CSS selector string.
*
* @var array
*/
protected $entities;


/**
* Constructs a \Drupal\entity_browser\Ajax\SelectEntities object.
*
* @param string $selector
* A CSS selector.
* @param string $uuid
* Entity browser instance UUID.
* @param array $entities
* Entities that were selected. Each entity is represented with an array
* consisting of three values (entity ID, entity UUID and entity type).
*/
public function __construct($uuid, $entities) {
$this->uuid = $uuid;
Expand All @@ -45,10 +47,10 @@ public function __construct($uuid, $entities) {
* Implements \Drupal\Core\Ajax\CommandInterface::render().
*/
public function render() {
return array(
return [
'command' => 'select_entities',
'uuid' => $this->uuid,
'entities' => $this->entities,
);
];
}
}
2 changes: 1 addition & 1 deletion src/Events/EntitySelectionEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class EntitySelectionEvent extends EventBase {
* Entity browser ID.
* @param string $instance_uuid
* Entity browser instance UUID.
* @param \Drupal\Core\Entity\EntityInterface[] $entites
* @param \Drupal\Core\Entity\EntityInterface[] $entities
* Array of selected entities.
*/
public function __construct($entity_browser_id, $instance_uuid, array $entities) {
Expand Down
2 changes: 1 addition & 1 deletion src/Kernel/Extension/EntityBrowserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ public function testDefaultWidget() {
/** @var $entity \Drupal\entity_browser\EntityBrowserInterface */
$entity = $this->controller->load('test');

/** @var \Drupal\entity_browser\Form\EntityBrowserFormInterface $form_object */
/** @var \Drupal\Core\Entity\EntityFormInterface $form_object */
$form_object = $this->container->get('entity.manager')->getFormObject($entity->getEntityTypeId(), 'entity_browser');
$form_object->setEntity($entity);
$form_state = new FormState();
Expand Down
4 changes: 1 addition & 3 deletions src/Plugin/EntityBrowser/Display/Modal.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ class Modal extends DisplayBase implements DisplayRouterInterface, DisplayAjaxIn
* The currently active route match object.
* @param \Drupal\Component\Uuid\UuidInterface
* UUID generator interface.
* @param \Symfony\Component\HttpFoundation\Request $request
* Current request.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, EventDispatcherInterface $event_dispatcher, RouteMatchInterface $current_route_match, UuidInterface $uuid, CurrentPathStack $current_path) {
parent::__construct($configuration, $plugin_id, $plugin_definition, $event_dispatcher);
Expand Down Expand Up @@ -220,7 +218,7 @@ public function widgetAjaxCallback(array &$form, FormStateInterface $form_state)
* @return array
*/
public function getAjaxCommands(FormStateInterface $form_state) {
$entities = array_map(function (EntityInterface $item) {return [$item->id(), $item->uuid(), $item->getEntityTypeId()];}, $form_state->get(['entity_browser', 'selected_entities']));
$entities = array_map(function(EntityInterface $item) {return [$item->id(), $item->uuid(), $item->getEntityTypeId()];}, $form_state->get(['entity_browser', 'selected_entities']));
$commands = array();
$commands[] = new SelectEntitiesCommand($this->uuid, $entities);
$commands[] = new CloseDialogCommand();
Expand Down
2 changes: 2 additions & 0 deletions src/Plugin/EntityBrowser/SelectionDisplay/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public function defaultConfiguration() {
* {@inheritdoc}
*/
public function getForm(array &$original_form, FormStateInterface $form_state) {
$form = [];

// TODO - do we need better error handling for view and view_display (in case
// either of those is nonexistent or display not of correct type)?
$storage = &$form_state->getStorage();
Expand Down
1 change: 1 addition & 0 deletions src/Plugin/EntityBrowser/Widget/Upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public function defaultConfiguration() {
* {@inheritdoc}
*/
public function getForm(array &$original_form, FormStateInterface $form_state, array $aditional_widget_parameters) {
$form = [];
$form['upload'] = [
'#type' => 'managed_file',
'#title' => t('Choose a file'),
Expand Down
1 change: 1 addition & 0 deletions src/Plugin/EntityBrowser/Widget/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public function defaultConfiguration() {
* {@inheritdoc}
*/
public function getForm(array &$original_form, FormStateInterface $form_state, array $aditional_widget_parameters) {
$form = [];
// TODO - do we need better error handling for view and view_display (in case
// either of those is nonexistent or display not of correct type)?
/** @var \Drupal\views\ViewExecutable $view */
Expand Down

0 comments on commit 12372ed

Please sign in to comment.