Commit 8a64a377 authored by Derek Wright's avatar Derek Wright
Browse files

Issue #3291954: 'Run phpcbf' --standard=Drupal on form_mode_manager.

By: dww, tauanygb, damiaosj, Rakhi Soni, Joel Guerreiro Borghi Filho
parent e3daa96c
Loading
Loading
Loading
Loading
+1 −1
Changes for src/AbstractEntityFormModesFactory.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -165,7 +165,7 @@ abstract class AbstractEntityFormModesFactory implements EntityFormModeManagerIn
      $entity_type_id = $route_object->getOption('_form_mode_manager_entity_type_id');
    }

    $entity_type_id = isset($entity_type_id) ? $entity_type_id : $entity->getEntityTypeId();
    $entity_type_id = $entity_type_id ?? $entity->getEntityTypeId();
    $operation = $this->getFormModeOperationName($this->formModeManager->getFormModeMachineName($form_mode_id));
    $is_active_form_mode = $this->formModeManager->isActive($entity_type_id, $bundle_id, $operation);

+1 −1
Changes for src/ComplexEntityFormModes.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -171,7 +171,7 @@ class ComplexEntityFormModes extends AbstractEntityFormModesFactory {
      'bundle_entity_type' => $bundle_entity_type_id,
      'entity_key' => $entity_type_key,
      'entity_type_id' => $entity_type_id,
      'form_mode' => isset($form_mode_definition[$entity_type_id][$form_mode]) ? $form_mode_definition[$entity_type_id][$form_mode] : NULL,
      'form_mode' => $form_mode_definition[$entity_type_id][$form_mode] ?? NULL,
    ];
  }

+3 −3
Changes for src/FormModeManager.php: 3 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -244,7 +244,7 @@ class FormModeManager implements FormModeManagerInterface {
   * {@inheritdoc}
   */
  public function isActive($entity_type_id, $bundle_id, $form_mode_machine_name) {
    $bundle_id = isset($bundle_id) ? $bundle_id : $entity_type_id;
    $bundle_id = $bundle_id ?? $entity_type_id;
    $form_mode_active = array_keys($this->entityDisplayRepository->getFormModeOptionsByBundle($entity_type_id, $bundle_id));
    return in_array($form_mode_machine_name, $form_mode_active);
  }
@@ -304,7 +304,7 @@ class FormModeManager implements FormModeManagerInterface {
    $form_modes_to_exclude = [];
    $config = $this->configFactory->get('form_mode_manager.settings')
      ->get('form_modes');
    $excluded_form_modes = isset($config) ? $config : [];
    $excluded_form_modes = $config ?? [];
    foreach ($excluded_form_modes as $entity_type_id => $modes_excluded) {
      $form_modes_to_exclude[$entity_type_id][] = $modes_excluded;
    }
@@ -366,7 +366,7 @@ class FormModeManager implements FormModeManagerInterface {
    $load_ids = [];
    for ($index = 0; count($ids) > $index; $index++) {
      $config_id = str_replace(self::ENTITY_FORM_DISPLAY_CONFIG_PREFIX . '.', '', $ids[$index]);
      list(,, $form_mode_name) = explode('.', $config_id);
      [,, $form_mode_name] = explode('.', $config_id);
      if ($form_mode_name !== 'default') {
        $load_ids[] = $config_id;
      }
+5 −5
Changes for src/Plugin/Derivative/FormModeManagerLocalAction.php: 5 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -78,7 +78,7 @@ class FormModeManagerLocalAction extends DeriverBase implements ContainerDeriver

          $this->setDefaultLocalTask($form_mode, $entity_type_id, $form_mode_name);

          // @TODO Use EntityRoutingMap to retrieve route_name,
          // @todo Use EntityRoutingMap to retrieve route_name,
          // of admin_create operation.
          if ($this->isUserEntityType($entity_type_id)) {
            $this->derivatives[$form_mode['id']]['route_name'] = "user.admin_create.$form_mode_name";
@@ -118,7 +118,7 @@ class FormModeManagerLocalAction extends DeriverBase implements ContainerDeriver
        '@entity_label' => strtolower($entity_storage->getEntityType()->getLabel()),
      ]),
      'route_parameters' => ['form_mode_name' => $form_mode_name],
      // @TODO Use EntityRoutingMap to retrieve generic appears_on.
      // @todo Use EntityRoutingMap to retrieve generic appears_on.
      'appears_on' => ["entity.{$entity_type_id}.collection"],
      'cache_tags' => $this->formModeManager->getListCacheTags(),
    ];
@@ -152,7 +152,7 @@ class FormModeManagerLocalAction extends DeriverBase implements ContainerDeriver
   * @param string $entity_type_id
   *   An entity type id.
   *
   * @TODO Use EntityRoutingMap to retrieve appears_on.
   * @todo Use EntityRoutingMap to retrieve appears_on.
   */
  public function setNodeEntityType(array $form_mode, $entity_type_id) {
    if ('node' === $entity_type_id) {
@@ -168,7 +168,7 @@ class FormModeManagerLocalAction extends DeriverBase implements ContainerDeriver
   * @param string $entity_type_id
   *   An entity type id.
   *
   * @TODO Use EntityRoutingMap to retrieve appears_on.
   * @todo Use EntityRoutingMap to retrieve appears_on.
   */
  public function setMediaEntityType(array $form_mode, $entity_type_id) {
    if ('media' === $entity_type_id) {
@@ -184,7 +184,7 @@ class FormModeManagerLocalAction extends DeriverBase implements ContainerDeriver
   * @param string $entity_type_id
   *   An entity type id.
   *
   * @TODO Use EntityRoutingMap to retrieve appears_on.
   * @todo Use EntityRoutingMap to retrieve appears_on.
   */
  public function setTaxonomyTermEntityType(array $form_mode, $entity_type_id) {
    if ('taxonomy_term' === $entity_type_id) {
+9 −9
Changes for src/Plugin/Derivative/FormModeManagerLocalTasks.php: 9 added lines, 9 removed lines.
Original line number Diff line number Diff line
@@ -93,8 +93,8 @@ class FormModeManagerLocalTasks extends DeriverBase implements ContainerDeriverI
   * @param bool $is_default_task
   *   Determine context of tasks (defaults or form mode manager) derivative.
   *
   * @TODO Use EntityRoutingMap to format an entity generic route_name.
   * @TODO Use EntityRoutingMap to retrieve parent_id route_name.
   * @todo Use EntityRoutingMap to format an entity generic route_name.
   * @todo Use EntityRoutingMap to retrieve parent_id route_name.
   */
  private function blockContentEnhancer($element_name, $entity_type_id, $is_default_task = TRUE) {
    if ('block_content' === $entity_type_id) {
@@ -112,8 +112,8 @@ class FormModeManagerLocalTasks extends DeriverBase implements ContainerDeriverI
   * @param string $entity_type_id
   *   The entity type ID.
   *
   * @TODO Use EntityRoutingMap to format an entity generic route_name.
   * @TODO Use EntityRoutingMap to retrieve parent_id route_name.
   * @todo Use EntityRoutingMap to format an entity generic route_name.
   * @todo Use EntityRoutingMap to retrieve parent_id route_name.
   */
  private function setDefaultTasks($entity_type_id) {
    $this->derivatives["form_mode_manager.$entity_type_id.default.task_tab"] = [
@@ -159,9 +159,9 @@ class FormModeManagerLocalTasks extends DeriverBase implements ContainerDeriverI
   * @param string $entity_type_id
   *   The entity type ID.
   *
   * @TODO Use EntityRoutingMap to format an entity generic route_name.
   * @TODO Use EntityRoutingMap to retrieve base_route.
   * @TODO Make this part more generic now.
   * @todo Use EntityRoutingMap to format an entity generic route_name.
   * @todo Use EntityRoutingMap to retrieve base_route.
   * @todo Make this part more generic now.
   */
  private function setUserRegisterTasks(array $form_mode, $entity_type_id) {
    if ('user' === $entity_type_id) {
@@ -181,8 +181,8 @@ class FormModeManagerLocalTasks extends DeriverBase implements ContainerDeriverI
   * @param string $entity_type_id
   *   The entity type ID.
   *
   * @TODO Use EntityRoutingMap to format an entity generic route_name.
   * @TODO Use EntityRoutingMap to retrieve parent_id route_name.
   * @todo Use EntityRoutingMap to format an entity generic route_name.
   * @todo Use EntityRoutingMap to retrieve parent_id route_name.
   */
  private function setFormModesTasksBase(array $form_mode, $entity_type_id) {
    $this->derivatives["form_mode_manager.{$form_mode['id']}.task_tab"] = [
Loading