You are here

public function ReplicationForm::addTitle in Deploy - Content Staging 8

Format the title of the Replication process.

Return value

string The title formatted with source and target labels.

1 string reference to 'ReplicationForm::addTitle'
deploy.routing.yml in ./deploy.routing.yml
deploy.routing.yml

File

src/Entity/Form/ReplicationForm.php, line 43

Class

ReplicationForm
Form controller for Replication edit forms.

Namespace

Drupal\deploy\Entity\Form

Code

public function addTitle() {
  $this
    ->setEntity(Replication::create());
  if (!$this
    ->getDefaultSource() || !$this
    ->getDefaultTarget()) {
    return $this
      ->t('Error');
  }
  $target = $this
    ->getDefaultTarget();
  $remote_name = '';
  if (!empty($target->remote_database->value) && !empty($target->remote_pointer->entity)) {
    $target_workspace_name = $target->remote_database->value;
    $remote_name = $target->remote_pointer->entity
      ->label();
    $target_workspace_name = ucfirst($target_workspace_name);
    $message = 'Deploy changes from local @source workspace to @target workspace on @remote';
  }
  else {
    $target_workspace_name = $this
      ->getDefaultTarget()
      ->label();
    $message = 'Deploy changes from local @source workspace to @target workspace';
  }
  return $this
    ->t($message, [
    '@source' => $this
      ->getDefaultSource()
      ->label(),
    '@target' => $target_workspace_name,
    '@remote' => $remote_name,
  ]);
}