@@ -25,14 +25,14 @@ |
||
| 25 | 25 | */ |
| 26 | 26 | public function getRowId(ResultRow $row) { |
| 27 | 27 | $entity = $this->getEntity($row); |
| 28 | - return $entity->getEntityTypeId() . ':' . $entity->id(); |
|
| 28 | + return $entity->getEntityTypeId().':'.$entity->id(); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | 32 | * {@inheritdoc} |
| 33 | 33 | */ |
| 34 | 34 | public function render(ResultRow $values) { |
| 35 | - return ViewsRenderPipelineMarkup::create('<!--form-item-' . $this->options['id'] . '--' . $this->getRowId($values) . '-->'); |
|
| 35 | + return ViewsRenderPipelineMarkup::create('<!--form-item-'.$this->options['id'].'--'.$this->getRowId($values).'-->'); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -146,7 +146,7 @@ |
||
| 146 | 146 | $form_element_row_id = $select->getRowId($row); |
| 147 | 147 | |
| 148 | 148 | $substitutions[] = [ |
| 149 | - 'placeholder' => '<!--form-item-entity_browser_select--' . $form_element_row_id . '-->', |
|
| 149 | + 'placeholder' => '<!--form-item-entity_browser_select--'.$form_element_row_id.'-->', |
|
| 150 | 150 | 'field_name' => 'entity_browser_select', |
| 151 | 151 | 'row_id' => $form_element_row_id, |
| 152 | 152 | ]; |
@@ -54,8 +54,7 @@ |
||
| 54 | 54 | // that directly. |
| 55 | 55 | if ($option == 'use_ajax') { |
| 56 | 56 | return TRUE; |
| 57 | - } |
|
| 58 | - else { |
|
| 57 | + } else { |
|
| 59 | 58 | return parent::getOption($option); |
| 60 | 59 | } |
| 61 | 60 | } |
@@ -125,8 +125,7 @@ discard block |
||
| 125 | 125 | return [ |
| 126 | 126 | '#markup' => $this->t('Entity browser select form field not found on a view. <a href=":link">Go fix it</a>!', [':link' => $url]), |
| 127 | 127 | ]; |
| 128 | - } |
|
| 129 | - else { |
|
| 128 | + } else { |
|
| 130 | 129 | return [ |
| 131 | 130 | '#markup' => $this->t('Entity browser select form field not found on a view. Go fix it!'), |
| 132 | 131 | ]; |
@@ -184,8 +183,7 @@ discard block |
||
| 184 | 183 | ]); |
| 185 | 184 | $form_state->setError($form['widget']['view']['entity_browser_select'], $message); |
| 186 | 185 | } |
| 187 | - } |
|
| 188 | - catch (PluginNotFoundException $e) { |
|
| 186 | + } catch (PluginNotFoundException $e) { |
|
| 189 | 187 | $message = $this->t('The Entity Type @type does not exist.', [ |
| 190 | 188 | '@type' => $parts[0], |
| 191 | 189 | ]); |
@@ -238,13 +238,13 @@ |
||
| 238 | 238 | foreach ($displays as $display) { |
| 239 | 239 | list($view_id, $display_id) = $display; |
| 240 | 240 | $view = $this->entityTypeManager->getStorage('view')->load($view_id); |
| 241 | - $options[$view_id . '.' . $display_id] = $this->t('@view : @display', ['@view' => $view->label(), '@display' => $view->get('display')[$display_id]['display_title']]); |
|
| 241 | + $options[$view_id.'.'.$display_id] = $this->t('@view : @display', ['@view' => $view->label(), '@display' => $view->get('display')[$display_id]['display_title']]); |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | $form['view'] = [ |
| 245 | 245 | '#type' => 'select', |
| 246 | 246 | '#title' => $this->t('View : View display'), |
| 247 | - '#default_value' => $this->configuration['view'] . '.' . $this->configuration['view_display'], |
|
| 247 | + '#default_value' => $this->configuration['view'].'.'.$this->configuration['view_display'], |
|
| 248 | 248 | '#options' => $options, |
| 249 | 249 | '#empty_option' => $this->t('- Select a view -'), |
| 250 | 250 | '#required' => TRUE, |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | '#theme_wrappers' => ['container'], |
| 54 | 54 | 'path' => [ |
| 55 | 55 | '#type' => 'hidden', |
| 56 | - '#value' => Url::fromRoute('entity_browser.' . $this->configuration['entity_browser_id'], [], $data['query_parameters'])->toString(), |
|
| 56 | + '#value' => Url::fromRoute('entity_browser.'.$this->configuration['entity_browser_id'], [], $data['query_parameters'])->toString(), |
|
| 57 | 57 | ], |
| 58 | 58 | 'open_modal' => [ |
| 59 | 59 | '#type' => 'submit', |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | |
| 108 | 108 | $field_name = $triggering_element['#parents'][0]; |
| 109 | 109 | $element_name = $this->configuration['entity_browser_id']; |
| 110 | - $name = 'entity_browser_iframe_' . $element_name; |
|
| 110 | + $name = 'entity_browser_iframe_'.$element_name; |
|
| 111 | 111 | $content = [ |
| 112 | 112 | '#prefix' => '<div class="ajax-progress-throbber"></div>', |
| 113 | 113 | '#type' => 'html_tag', |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | $html = drupal_render($content); |
| 127 | 127 | |
| 128 | 128 | $response = new AjaxResponse(); |
| 129 | - $response->addCommand(new OpenDialogCommand('#' . Html::getUniqueId($field_name . '-' . $element_name . '-dialog'), $this->configuration['link_text'], $html, [ |
|
| 129 | + $response->addCommand(new OpenDialogCommand('#'.Html::getUniqueId($field_name.'-'.$element_name.'-dialog'), $this->configuration['link_text'], $html, [ |
|
| 130 | 130 | 'width' => 'auto', |
| 131 | 131 | 'height' => 'auto', |
| 132 | 132 | 'modal' => TRUE, |
@@ -96,8 +96,7 @@ |
||
| 96 | 96 | $triggering_element = $form_state->getTriggeringElement(); |
| 97 | 97 | if ($triggering_element['#name'] == 'prev_page') { |
| 98 | 98 | $page--; |
| 99 | - } |
|
| 100 | - elseif ($triggering_element['#name'] == 'next_page') { |
|
| 99 | + } elseif ($triggering_element['#name'] == 'next_page') { |
|
| 101 | 100 | $page++; |
| 102 | 101 | } |
| 103 | 102 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | * {@inheritdoc} |
| 100 | 100 | */ |
| 101 | 101 | public function getForm(array &$original_form, FormStateInterface $form_state, array $additional_widget_parameters) { |
| 102 | - if (empty($this->configuration['entity_type']) || empty($this->configuration['bundle']) || empty($this->configuration['form_mode'])) { |
|
| 102 | + if (empty($this->configuration['entity_type']) || empty($this->configuration['bundle']) || empty($this->configuration['form_mode'])) { |
|
| 103 | 103 | return ['#markup' => $this->t('The settings for this widget (Entity type, Bundle or Form mode) are not configured correctly.')]; |
| 104 | 104 | } |
| 105 | 105 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | |
| 108 | 108 | // Pretend to be IEFs submit button. |
| 109 | 109 | $form['#submit'] = [['Drupal\inline_entity_form\ElementSubmit', 'trigger']]; |
| 110 | - $form['actions']['submit']['#ief_submit_trigger'] = TRUE; |
|
| 110 | + $form['actions']['submit']['#ief_submit_trigger'] = TRUE; |
|
| 111 | 111 | $form['actions']['submit']['#ief_submit_trigger_all'] = TRUE; |
| 112 | 112 | |
| 113 | 113 | $form['inline_entity_form'] = [ |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | $entities = $this->prepareEntities($form, $form_state); |
| 137 | 137 | array_walk( |
| 138 | 138 | $entities, |
| 139 | - function (EntityInterface $entity) { |
|
| 139 | + function(EntityInterface $entity) { |
|
| 140 | 140 | $entity->save(); |
| 141 | 141 | } |
| 142 | 142 | ); |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | $definitions = $this->entityTypeManager->getDefinitions(); |
| 159 | 159 | $entity_types = array_combine( |
| 160 | 160 | array_keys($definitions), |
| 161 | - array_map(function (EntityTypeInterface $item) { |
|
| 161 | + array_map(function(EntityTypeInterface $item) { |
|
| 162 | 162 | return $item->getLabel(); |
| 163 | 163 | }, $definitions) |
| 164 | 164 | ); |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | $bundles = []; |
| 177 | 177 | if ($entity_type) { |
| 178 | 178 | $definitions = $this->entityTypeBundleInfo->getBundleInfo($entity_type); |
| 179 | - $bundles = array_map(function ($item) { |
|
| 179 | + $bundles = array_map(function($item) { |
|
| 180 | 180 | return $item['label']; |
| 181 | 181 | }, $definitions); |
| 182 | 182 | } |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | '#options' => $bundles, |
| 190 | 190 | '#default_value' => $bundle, |
| 191 | 191 | ], |
| 192 | - '#attributes' => ['id' => 'bundle-wrapper-' . $this->uuid()], |
|
| 192 | + '#attributes' => ['id' => 'bundle-wrapper-'.$this->uuid()], |
|
| 193 | 193 | ]; |
| 194 | 194 | |
| 195 | 195 | $form['form_mode'] = [ |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | '#default_value' => $form_mode, |
| 201 | 201 | '#options' => $this->entityDisplayRepository->getFormModeOptions($entity_type), |
| 202 | 202 | ], |
| 203 | - '#attributes' => ['id' => 'form-mode-wrapper-' . $this->uuid()], |
|
| 203 | + '#attributes' => ['id' => 'form-mode-wrapper-'.$this->uuid()], |
|
| 204 | 204 | ]; |
| 205 | 205 | |
| 206 | 206 | return $form; |
@@ -225,8 +225,8 @@ discard block |
||
| 225 | 225 | */ |
| 226 | 226 | public function updateFormElements($form, FormStateInterface $form_state) { |
| 227 | 227 | $response = new AjaxResponse(); |
| 228 | - $response->addCommand(new ReplaceCommand('#bundle-wrapper-' . $this->uuid(), $this->updateBundle($form, $form_state))); |
|
| 229 | - $response->addCommand(new ReplaceCommand('#form-mode-wrapper-' . $this->uuid(), $this->updateFormMode($form, $form_state))); |
|
| 228 | + $response->addCommand(new ReplaceCommand('#bundle-wrapper-'.$this->uuid(), $this->updateBundle($form, $form_state))); |
|
| 229 | + $response->addCommand(new ReplaceCommand('#form-mode-wrapper-'.$this->uuid(), $this->updateFormMode($form, $form_state))); |
|
| 230 | 230 | return $response; |
| 231 | 231 | } |
| 232 | 232 | |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | |
| 213 | 213 | $delta = 0; |
| 214 | 214 | |
| 215 | - $order_class = $field_machine_name . '-delta-order'; |
|
| 215 | + $order_class = $field_machine_name.'-delta-order'; |
|
| 216 | 216 | |
| 217 | 217 | $current = [ |
| 218 | 218 | '#type' => 'table', |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | $current[$entity_id] = [ |
| 283 | 283 | '#attributes' => [ |
| 284 | 284 | 'class' => ['draggable'], |
| 285 | - 'data-entity-id' => $entity->getEntityTypeId() . ':' . $entity_id, |
|
| 285 | + 'data-entity-id' => $entity->getEntityTypeId().':'.$entity_id, |
|
| 286 | 286 | 'data-row-id' => $delta, |
| 287 | 287 | ], |
| 288 | 288 | ]; |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | 'options' => ['query' => ['details_id' => $details_id]], |
| 355 | 355 | ], |
| 356 | 356 | '#attributes' => [ |
| 357 | - 'data-entity-id' => $entity->getEntityTypeId() . ':' . $entity->id(), |
|
| 357 | + 'data-entity-id' => $entity->getEntityTypeId().':'.$entity->id(), |
|
| 358 | 358 | 'data-row-id' => $delta, |
| 359 | 359 | ], |
| 360 | 360 | '#access' => $edit_button_access, |
@@ -367,10 +367,10 @@ discard block |
||
| 367 | 367 | 'wrapper' => $details_id, |
| 368 | 368 | ], |
| 369 | 369 | '#submit' => [[get_class($this), 'removeItemSubmit']], |
| 370 | - '#name' => $field_machine_name . '_remove_' . $entity_id . '_' . md5(json_encode($field_parents)), |
|
| 370 | + '#name' => $field_machine_name.'_remove_'.$entity_id.'_'.md5(json_encode($field_parents)), |
|
| 371 | 371 | '#limit_validation_errors' => [array_merge($field_parents, [$field_machine_name, 'target_id'])], |
| 372 | 372 | '#attributes' => [ |
| 373 | - 'data-entity-id' => $entity->getEntityTypeId() . ':' . $entity->id(), |
|
| 373 | + 'data-entity-id' => $entity->getEntityTypeId().':'.$entity->id(), |
|
| 374 | 374 | 'data-row-id' => $delta, |
| 375 | 375 | ], |
| 376 | 376 | '#access' => (bool) $widget_settings['field_widget_remove'], |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | } |
| 429 | 429 | |
| 430 | 430 | // Return ourself as the structure doesn't match the default. |
| 431 | - usort($return, function ($a, $b) { |
|
| 431 | + usort($return, function($a, $b) { |
|
| 432 | 432 | return SortArray::sortByKeyInt($a, $b, '_weight'); |
| 433 | 433 | }); |
| 434 | 434 | |
@@ -491,7 +491,7 @@ discard block |
||
| 491 | 491 | // Add validators based on our current settings. |
| 492 | 492 | $data['validators']['file'] = ['validators' => $this->getFileValidators()]; |
| 493 | 493 | // Provide context for widgets to enhance their configuration. |
| 494 | - $data['widget_context']['upload_location'] = $settings['uri_scheme'] . '://' . $settings['file_directory']; |
|
| 494 | + $data['widget_context']['upload_location'] = $settings['uri_scheme'].'://'.$settings['file_directory']; |
|
| 495 | 495 | $data['widget_context']['upload_validators'] = $this->getFileValidators(TRUE); |
| 496 | 496 | return $data; |
| 497 | 497 | } |
@@ -180,8 +180,7 @@ discard block |
||
| 180 | 180 | // their styles in code. |
| 181 | 181 | elseif ($this->fieldDefinition->getType() == 'image' && $image_style = ImageStyle::load($image_style_setting)) { |
| 182 | 182 | $preview_image_style = $this->t('Preview image style: @style', ['@style' => $image_style->label()]); |
| 183 | - } |
|
| 184 | - else { |
|
| 183 | + } else { |
|
| 185 | 184 | $preview_image_style = $this->t('No preview image'); |
| 186 | 185 | } |
| 187 | 186 | array_unshift($summary, $preview_image_style); |
@@ -248,8 +247,7 @@ discard block |
||
| 248 | 247 | // will only throw an exception. |
| 249 | 248 | if (!$entity->getEntityType()->getFormClass('edit')) { |
| 250 | 249 | $edit_button_access = FALSE; |
| 251 | - } |
|
| 252 | - elseif ($has_file_entity) { |
|
| 250 | + } elseif ($has_file_entity) { |
|
| 253 | 251 | $edit_button_access = $can_edit && $entity->access('update', $this->currentUser); |
| 254 | 252 | } |
| 255 | 253 | |
@@ -268,8 +266,7 @@ discard block |
||
| 268 | 266 | if ($field_type == 'file') { |
| 269 | 267 | $description = $item->description; |
| 270 | 268 | $display_field = $item->display; |
| 271 | - } |
|
| 272 | - elseif ($field_type == 'image') { |
|
| 269 | + } elseif ($field_type == 'image') { |
|
| 273 | 270 | $alt = $item->alt; |
| 274 | 271 | $title = $item->title; |
| 275 | 272 | $width = $item->width; |
@@ -474,8 +471,7 @@ discard block |
||
| 474 | 471 | if (!empty($settings['max_resolution']) || !empty($settings['min_resolution'])) { |
| 475 | 472 | $validators['entity_browser_file_validate_image_resolution'] = [$settings['max_resolution'], $settings['min_resolution']]; |
| 476 | 473 | } |
| 477 | - } |
|
| 478 | - elseif (!empty($settings['file_extensions'])) { |
|
| 474 | + } elseif (!empty($settings['file_extensions'])) { |
|
| 479 | 475 | $validators['file_validate_extensions'] = [$settings['file_extensions']]; |
| 480 | 476 | } |
| 481 | 477 | |
@@ -18,15 +18,15 @@ discard block |
||
| 18 | 18 | switch ($route_name) { |
| 19 | 19 | case 'help.page.entity_browser': |
| 20 | 20 | $output = ''; |
| 21 | - $output .= '<h3>' . t('About') . '</h3>'; |
|
| 22 | - $output .= '<p>' . t('The Entity Browser module provides a generic entity browser/picker/selector. It can be used in any context where one needs to select a few entities and do something with them. For more information, see the online documentation for <a href=":entity_browser-documentation">Entity Browser</a>.', [':entity_browser-documentation' => 'https://drupal-media.gitbooks.io/drupal8-guide/content/modules/entity_browser/intro.html']) . '</p>'; |
|
| 23 | - $output .= '<h3>' . t('Uses') . '</h3>'; |
|
| 21 | + $output .= '<h3>'.t('About').'</h3>'; |
|
| 22 | + $output .= '<p>'.t('The Entity Browser module provides a generic entity browser/picker/selector. It can be used in any context where one needs to select a few entities and do something with them. For more information, see the online documentation for <a href=":entity_browser-documentation">Entity Browser</a>.', [':entity_browser-documentation' => 'https://drupal-media.gitbooks.io/drupal8-guide/content/modules/entity_browser/intro.html']).'</p>'; |
|
| 23 | + $output .= '<h3>'.t('Uses').'</h3>'; |
|
| 24 | 24 | $output .= '<dl>'; |
| 25 | - $output .= '<dt>' . t('General') . '</dt>'; |
|
| 26 | - $output .= '<dd>' . t('Entity browser comes with an example module that can be used as a starting point.') . '</dd>'; |
|
| 27 | - $output .= '<dt>' . t('Example use cases') . '</dt>'; |
|
| 28 | - $output .= '<dd>' . t('Powerfull entity reference widget') . '</dd>'; |
|
| 29 | - $output .= '<dd>' . t('Embedding entities into wysiwyg') . '</dd>'; |
|
| 25 | + $output .= '<dt>'.t('General').'</dt>'; |
|
| 26 | + $output .= '<dd>'.t('Entity browser comes with an example module that can be used as a starting point.').'</dd>'; |
|
| 27 | + $output .= '<dt>'.t('Example use cases').'</dt>'; |
|
| 28 | + $output .= '<dd>'.t('Powerfull entity reference widget').'</dd>'; |
|
| 29 | + $output .= '<dd>'.t('Embedding entities into wysiwyg').'</dd>'; |
|
| 30 | 30 | $output .= '</dl>'; |
| 31 | 31 | |
| 32 | 32 | return $output; |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | /** |
| 67 | 67 | * Implements hook_form_alter(). |
| 68 | 68 | */ |
| 69 | -function entity_browser_form_alter(&$form, FormStateInterface &$form_state) { |
|
| 69 | +function entity_browser_form_alter(&$form, FormStateInterface&$form_state) { |
|
| 70 | 70 | $entity_browser_dialog_edit = \Drupal::service('request_stack')->getCurrentRequest()->get('_route'); |
| 71 | 71 | if ($entity_browser_dialog_edit == 'entity_browser.edit_form') { |
| 72 | 72 | // Let's allow the save button only. |
@@ -150,8 +150,7 @@ |
||
| 150 | 150 | $image->save(); |
| 151 | 151 | $file->filesize = $image->getFileSize(); |
| 152 | 152 | drupal_set_message(t('The image was resized to fit within the maximum allowed dimensions of %dimensions pixels.', ['%dimensions' => $maximum_dimensions])); |
| 153 | - } |
|
| 154 | - else { |
|
| 153 | + } else { |
|
| 155 | 154 | $errors[] = t('The image exceeds the maximum allowed dimensions.'); |
| 156 | 155 | } |
| 157 | 156 | } |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | |
| 59 | 59 | foreach ($browsers as $browser) { |
| 60 | 60 | if ($browser->route()) { |
| 61 | - $permissions['access ' . $browser->id() . ' entity browser pages'] = [ |
|
| 61 | + $permissions['access '.$browser->id().' entity browser pages'] = [ |
|
| 62 | 62 | 'title' => $this->translationManager->translate('Access @name pages', ['@name' => $browser->label()]), |
| 63 | 63 | 'description' => $this->translationManager->translate('Access pages that %browser uses to operate.', ['%browser' => $browser->label()]), |
| 64 | 64 | ]; |