You are here

class RouteCallback in Contact Emails 8

Defines dynamic routes.

Hierarchy

Expanded class hierarchy of RouteCallback

File

src/Routing/RouteCallback.php, line 10

Namespace

Drupal\contact_emails\Routing
View source
class RouteCallback {

  /**
   * {@inheritdoc}
   */
  public function addFormTitle() {
    $route_match = \Drupal::routeMatch();
    $contact_form = $route_match
      ->getParameter('contact_form');
    return t('Add New Contact Email to "@contact_form"', [
      '@contact_form' => $contact_form
        ->label(),
    ]);
  }

  /**
   * {@inheritdoc}
   */
  public function editFormTitle() {
    $route_match = \Drupal::routeMatch();
    $contact_email = $route_match
      ->getParameter('contact_email');
    $contact_form_id = $contact_email
      ->get('contact_form')->target_id;
    $contact_form = ContactForm::load($contact_form_id);
    return t('Edit Contact Email @id for "@contact_form"', [
      '@id' => $contact_email
        ->id(),
      '@contact_form' => $contact_form
        ->label(),
    ]);
  }

}

Members