@@ -116,8 +116,7 @@ |
||
| 116 | 116 | |
| 117 | 117 | if (!$this->isSelectionCompleted($form_state)) { |
| 118 | 118 | $form_state->setRebuild(); |
| 119 | - } |
|
| 120 | - else { |
|
| 119 | + } else { |
|
| 121 | 120 | $entity_browser->getDisplay()->selectionCompleted($this->getSelectedEntities($form_state)); |
| 122 | 121 | } |
| 123 | 122 | } |
@@ -43,12 +43,12 @@ |
||
| 43 | 43 | // Return the form as a modal dialog. |
| 44 | 44 | $form['#attached']['library'][] = 'core/drupal.dialog.ajax'; |
| 45 | 45 | $title = $this->t('Edit entity @entity', ['@entity' => $entity->label()]); |
| 46 | - $response = AjaxResponse::create()->addCommand(new OpenDialogCommand('#' . $entity->getEntityTypeId() . '-' . $entity->id() . '-edit-dialog', $title, $form, ['modal' => TRUE, 'width' => 800])); |
|
| 46 | + $response = AjaxResponse::create()->addCommand(new OpenDialogCommand('#'.$entity->getEntityTypeId().'-'.$entity->id().'-edit-dialog', $title, $form, ['modal' => TRUE, 'width' => 800])); |
|
| 47 | 47 | return $response; |
| 48 | 48 | } |
| 49 | 49 | else { |
| 50 | 50 | // Return command for closing the modal. |
| 51 | - $response = AjaxResponse::create()->addCommand(new CloseDialogCommand('#' . $entity->getEntityTypeId() . '-' . $entity->id() . '-edit-dialog')); |
|
| 51 | + $response = AjaxResponse::create()->addCommand(new CloseDialogCommand('#'.$entity->getEntityTypeId().'-'.$entity->id().'-edit-dialog')); |
|
| 52 | 52 | // Also refresh the widget if "details_id" is provided. |
| 53 | 53 | $details_id = $request->query->get('details_id'); |
| 54 | 54 | if (!empty($details_id)) { |
@@ -124,8 +124,7 @@ discard block |
||
| 124 | 124 | return [ |
| 125 | 125 | '#markup' => t('Entity browser select form field not found on a view. <a href=":link">Go fix it</a>!', [':link' => $url]), |
| 126 | 126 | ]; |
| 127 | - } |
|
| 128 | - else { |
|
| 127 | + } else { |
|
| 129 | 128 | return [ |
| 130 | 129 | '#markup' => t('Entity browser select form field not found on a view. Go fix it!'), |
| 131 | 130 | ]; |
@@ -183,8 +182,7 @@ discard block |
||
| 183 | 182 | ]); |
| 184 | 183 | $form_state->setError($form['widget']['view']['entity_browser_select'], $message); |
| 185 | 184 | } |
| 186 | - } |
|
| 187 | - catch (PluginNotFoundException $e) { |
|
| 185 | + } catch (PluginNotFoundException $e) { |
|
| 188 | 186 | $message = t('The Entity Type @type does not exist.', [ |
| 189 | 187 | '@type' => $parts[0], |
| 190 | 188 | ]); |
@@ -216,13 +216,13 @@ |
||
| 216 | 216 | foreach ($displays as $display) { |
| 217 | 217 | list($view_id, $display_id) = $display; |
| 218 | 218 | $view = $this->entityManager->getStorage('view')->load($view_id); |
| 219 | - $options[$view_id . '.' . $display_id] = $this->t('@view : @display', array('@view' => $view->label(), '@display' => $view->get('display')[$display_id]['display_title'])); |
|
| 219 | + $options[$view_id.'.'.$display_id] = $this->t('@view : @display', array('@view' => $view->label(), '@display' => $view->get('display')[$display_id]['display_title'])); |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | $form['view'] = [ |
| 223 | 223 | '#type' => 'select', |
| 224 | 224 | '#title' => $this->t('View : View display'), |
| 225 | - '#default_value' => $this->configuration['view'] . '.' . $this->configuration['view_display'], |
|
| 225 | + '#default_value' => $this->configuration['view'].'.'.$this->configuration['view_display'], |
|
| 226 | 226 | '#options' => $options, |
| 227 | 227 | '#empty_option' => $this->t('- Select a view -'), |
| 228 | 228 | '#required' => TRUE, |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | /** |
| 43 | 43 | * Implements hook_form_alter(). |
| 44 | 44 | */ |
| 45 | -function entity_browser_form_alter(&$form, FormStateInterface &$form_state) { |
|
| 45 | +function entity_browser_form_alter(&$form, FormStateInterface&$form_state) { |
|
| 46 | 46 | $entity_browser_dialog_edit = \Drupal::service('request_stack')->getCurrentRequest()->get('_route'); |
| 47 | 47 | if ($entity_browser_dialog_edit == 'entity_browser.edit_form') { |
| 48 | 48 | // Let's allow the save button only. |
@@ -122,8 +122,7 @@ |
||
| 122 | 122 | $image->save(); |
| 123 | 123 | $file->filesize = $image->getFileSize(); |
| 124 | 124 | drupal_set_message(t('The image was resized to fit within the maximum allowed dimensions of %dimensions pixels.', array('%dimensions' => $maximum_dimensions))); |
| 125 | - } |
|
| 126 | - else { |
|
| 125 | + } else { |
|
| 127 | 126 | $errors[] = t('The image exceeds the maximum allowed dimensions.'); |
| 128 | 127 | } |
| 129 | 128 | } |
@@ -34,9 +34,7 @@ |
||
| 34 | 34 | * The entity manager. |
| 35 | 35 | * @param $tempstore_id |
| 36 | 36 | * The shared temp store factory collection name. |
| 37 | - * @param null $machine_name |
|
| 38 | - * The SharedTempStore key for our current wizard values. |
|
| 39 | - * @param null $step |
|
| 37 | + * @param string|null $step |
|
| 40 | 38 | * The current active step of the wizard. |
| 41 | 39 | */ |
| 42 | 40 | public function __construct(SharedTempStoreFactory $tempstore, FormBuilderInterface $builder, ClassResolverInterface $class_resolver, EventDispatcherInterface $event_dispatcher, EntityManagerInterface $entity_manager, RouteMatchInterface $route_match, $tempstore_id, $entity_browser = NULL, $step = 'general') { |
@@ -67,7 +67,7 @@ |
||
| 67 | 67 | $file = File::load(1); |
| 68 | 68 | // Test entity browser token that has upload location configured to |
| 69 | 69 | // public://[current-user:account-name]/ |
| 70 | - $this->assertEqual($file->getFileUri(), 'public://' . $account->getUsername() . '/' . $file->getFilename(), 'Image has the correct uri.'); |
|
| 70 | + $this->assertEqual($file->getFileUri(), 'public://'.$account->getUsername().'/'.$file->getFilename(), 'Image has the correct uri.'); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | } |
@@ -116,8 +116,7 @@ |
||
| 116 | 116 | |
| 117 | 117 | if (!$this->isSelectionCompleted($form_state)) { |
| 118 | 118 | $form_state->setRebuild(); |
| 119 | - } |
|
| 120 | - else { |
|
| 119 | + } else { |
|
| 121 | 120 | $entity_browser->getDisplay()->selectionCompleted($this->getSelectedEntities($form_state)); |
| 122 | 121 | } |
| 123 | 122 | } |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | /** |
| 19 | 19 | * Implements hook_inline_entity_form_reference_form_alter(). |
| 20 | 20 | */ |
| 21 | -function entity_browser_entity_form_inline_entity_form_reference_form_alter(&$reference_form, FormStateInterface &$form_state) { |
|
| 21 | +function entity_browser_entity_form_inline_entity_form_reference_form_alter(&$reference_form, FormStateInterface&$form_state) { |
|
| 22 | 22 | /** @var \Drupal\field\FieldConfigInterface $instance */ |
| 23 | 23 | $instance = $form_state->get([ |
| 24 | 24 | 'inline_entity_form', |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | ]); |
| 28 | 28 | |
| 29 | 29 | /** @var \Drupal\Core\Entity\Display\EntityFormDisplayInterface $form_display */ |
| 30 | - $entity_form_id = $instance->getTargetEntityTypeId() . '.' . $instance->getTargetBundle() . '.default'; |
|
| 30 | + $entity_form_id = $instance->getTargetEntityTypeId().'.'.$instance->getTargetBundle().'.default'; |
|
| 31 | 31 | // TODO - 'default' might become configurable or something else in the future. |
| 32 | 32 | // See https://www.drupal.org/node/2510274 |
| 33 | 33 | $form_display = \Drupal::entityTypeManager()->getStorage('entity_form_display')->load($entity_form_id); |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | ])); |
| 48 | 48 | |
| 49 | 49 | $cardinality = FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED; |
| 50 | - if($instance->getFieldStorageDefinition()->get('cardinality') !== $cardinality) { |
|
| 50 | + if ($instance->getFieldStorageDefinition()->get('cardinality') !== $cardinality) { |
|
| 51 | 51 | $cardinality = $instance->getFieldStorageDefinition()->get('cardinality') - $count_existing_selection; |
| 52 | 52 | } |
| 53 | 53 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | $ief_id = $reference_form['#ief_id']; |
| 120 | 120 | $form_values = NestedArray::getValue($form_state->getValues(), $reference_form['#parents']); |
| 121 | 121 | $attach_entities = EntityBrowserElement::processEntityIds($form_values['entity_browser']['entity_ids']); |
| 122 | - $entities =& $form_state->get(['inline_entity_form', $ief_id, 'entities']); |
|
| 122 | + $entities = & $form_state->get(['inline_entity_form', $ief_id, 'entities']); |
|
| 123 | 123 | |
| 124 | 124 | // Determine the correct weight of the new element. |
| 125 | 125 | $weight = 0; |
@@ -30,14 +30,14 @@ |
||
| 30 | 30 | */ |
| 31 | 31 | public function getRowId(ResultRow $row) { |
| 32 | 32 | $entity = $row->_entity; |
| 33 | - return $entity->getEntityTypeId() . ':' . $entity->id(); |
|
| 33 | + return $entity->getEntityTypeId().':'.$entity->id(); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | 37 | * {@inheritdoc} |
| 38 | 38 | */ |
| 39 | 39 | public function render(ResultRow $values) { |
| 40 | - return ViewsRenderPipelineMarkup::create('<!--form-item-' . $this->options['id'] . '--' . $this->getRowId($values) . '-->'); |
|
| 40 | + return ViewsRenderPipelineMarkup::create('<!--form-item-'.$this->options['id'].'--'.$this->getRowId($values).'-->'); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | 'entity_browser' => [ |
| 149 | 149 | 'iframe' => [ |
| 150 | 150 | $uuid => [ |
| 151 | - 'src' => Url::fromRoute('entity_browser.' . $this->configuration['entity_browser_id'], [], $data['query_parameters']) |
|
| 151 | + 'src' => Url::fromRoute('entity_browser.'.$this->configuration['entity_browser_id'], [], $data['query_parameters']) |
|
| 152 | 152 | ->toString(), |
| 153 | 153 | 'width' => $this->configuration['width'], |
| 154 | 154 | 'height' => $this->configuration['height'], |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | public function propagateSelection(FilterResponseEvent $event) { |
| 183 | 183 | $render = [ |
| 184 | 184 | 'labels' => [ |
| 185 | - '#markup' => 'Labels: ' . implode(', ', array_map(function (EntityInterface $item) { |
|
| 185 | + '#markup' => 'Labels: '.implode(', ', array_map(function(EntityInterface $item) { |
|
| 186 | 186 | return $item->label(); |
| 187 | 187 | }, $this->entities)), |
| 188 | 188 | '#attached' => [ |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | 'drupalSettings' => [ |
| 191 | 191 | 'entity_browser' => [ |
| 192 | 192 | 'iframe' => [ |
| 193 | - 'entities' => array_map(function (EntityInterface $item) { |
|
| 193 | + 'entities' => array_map(function(EntityInterface $item) { |
|
| 194 | 194 | return [$item->id(), $item->uuid(), $item->getEntityTypeId()]; |
| 195 | 195 | }, $this->entities), |
| 196 | 196 | 'uuid' => $this->request->query->get('uuid'), |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | * {@inheritdoc} |
| 209 | 209 | */ |
| 210 | 210 | public function path() { |
| 211 | - return '/entity-browser/iframe/' . $this->configuration['entity_browser_id']; |
|
| 211 | + return '/entity-browser/iframe/'.$this->configuration['entity_browser_id']; |
|
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | /** |
@@ -63,8 +63,8 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | $default_value = implode(' ', array_map( |
| 66 | - function (EntityInterface $item) { |
|
| 67 | - return $item->getEntityTypeId() . ':' . $item->id(); |
|
| 66 | + function(EntityInterface $item) { |
|
| 67 | + return $item->getEntityTypeId().':'.$item->id(); |
|
| 68 | 68 | }, |
| 69 | 69 | $element['#default_value'] |
| 70 | 70 | )); |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | ['validators' => $validators, 'selected_entities' => $element['#default_value']] |
| 86 | 86 | ); |
| 87 | 87 | |
| 88 | - $hidden_id = Html::getUniqueId($element['#id'] . '-target'); |
|
| 88 | + $hidden_id = Html::getUniqueId($element['#id'].'-target'); |
|
| 89 | 89 | $element['entity_ids'] = [ |
| 90 | 90 | '#type' => 'hidden', |
| 91 | 91 | '#id' => $hidden_id, |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | $element['#attached']['drupalSettings']['entity_browser'] = [ |
| 98 | 98 | $entity_browser->getDisplay()->getUuid() => [ |
| 99 | 99 | 'cardinality' => $element['#cardinality'], |
| 100 | - 'selector' => '#' . $hidden_id, |
|
| 100 | + 'selector' => '#'.$hidden_id, |
|
| 101 | 101 | ], |
| 102 | 102 | ]; |
| 103 | 103 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | return array_map( |
| 140 | - function ($item) { |
|
| 140 | + function($item) { |
|
| 141 | 141 | list($entity_type, $entity_id) = explode(':', $item); |
| 142 | 142 | return \Drupal::entityTypeManager()->getStorage($entity_type)->load($entity_id); |
| 143 | 143 | }, |
@@ -116,8 +116,7 @@ |
||
| 116 | 116 | |
| 117 | 117 | if (!$this->isSelectionCompleted($form_state)) { |
| 118 | 118 | $form_state->setRebuild(); |
| 119 | - } |
|
| 120 | - else { |
|
| 119 | + } else { |
|
| 121 | 120 | $entity_browser->getDisplay()->selectionCompleted($this->getSelectedEntities($form_state)); |
| 122 | 121 | } |
| 123 | 122 | } |