it would be great if we could specify an add, but especially an edit alias with each form mode. While the "add" alias can be made modules such as "Pathauto" (although it would already be great to see the form URL directly, and be able to create an alias "on the spot"), there's at first sight no easy solution to make an alias for an edit URL (eg. /user/16/edit/form_mode_name).

It would be great if we could add the following :

Form URL - ADD

Default form URL : /user/register/register_company_rep_step_2
URL alias : /company/user/registration

Form URL - EDIT

Default form URL : /user/[user:uid]/edit/register_company_rep_step_2
URL alias : /company/user/[user:uid]/edit

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dendreten created an issue. See original summary.

woprrr’s picture

Hi @dendreten,

Thank again for your participate on Form Mode Manager module : )

Like already we have spoken on slack, this kind of feature can be totally assumed by Form Mode Manager. Because Form Mode Manager are a tools to manipulate more simply the form modes implemented by core and provide routes/operation/entity form/links/tasks/permissions to be used more simply by Site Builders XOR Developper (this module is developper friendly at basis !).

All specific things like Theme Negociation / Role attribution (for user) are linked to entity system and usefull to add form modes dimension on it to permit a more powerfull system using form modes in each subject. Theme negociation / Role automatic attribution for user are already assumed in sub-modules because Form Mode Manager base allow you to add it more simply and easily. But in future Form mode manager can become OVERKILL and to big to be maintained simply and too big for very very simple usecases. To arround that Sub-modules or separated project with Form Mode Manager dependencies are a very good idea !

Url alias are same problems here ! PathAuto allow you to define automatic aliases based onto 'CANONICAL' urls. Form mode manager add a complex dimension ! and then we need to make new Pathauto plugins to retrieve 'edit-form.{FORM_MODE_NAME}' or 'default' for add urls. In Evry cases we have to adapt 'pathauto.generator' to allow this service to accept $entity->toUrl('xxx') to recover base links and then recover source alias (@see \Drupal\pathauto\PathautoGenerator::createEntityAlias)

After that we have to define the new plugin based on \Drupal\pathauto\Plugin\pathauto\AliasType\EntityAliasTypeBase to Make one plugin by couple Entity + form mode (one by form mode using same mecanics like \Drupal\pathauto\Plugin\Deriver\EntityAliasTypeDeriver).

All of these plugins will be in separate project with Form mode manager AND Pathauto.

If you don't want to use pathauto to generate your aliases automatically you have two solutions :

1/ Manually like this :

2/ With custom développements Like :
$this->aliasStorage->save($path['source'], $path['alias'], $path['language'], $path['pid']);

3/ With Pathauto but with custom module like :

    // Build the new path alias array and send it off to be created.
    $path = array(
      'source' => $source,
      'alias' => $alias,
      'language' => $langcode,
    );

    $return  = $this->aliasStorageHelper->save($path, $existing_alias, $op)

$op can be (bulkupdate, update, insert).

I will speak with Berdir to found the best solutions for us and evaluate if adding an interface in form mode manager to manage urls can be a good idea for cohésion of Drupal system.

I hope this respond to your waiting.

woprrr’s picture

I have thinked an UI Like :

woprrr’s picture

Status: Active » Postponed
Related issues: +#2336597: Convert path aliases to full featured entities

Spoken with @amateescu on contribute channel.

I would suggest waiting for 8.7 and in the meantime allow people to use a patch from that issue along with the conversion to an entity patch for core.

The solutions 2 and 3 could be re developped in 8.7 if FMM assume that. In other words we have to waiting for #2336597: Convert path aliases to full featured entities

I postponed that issue and re-open as working when all is OK to working on it.

The workarround to you is to using solution 1 OR in a custom module implemented your own aliases strategy like solution 2

$this->aliasStorage->save($path['source'], $path['alias'], $path['language'], $path['pid']);

dendreten’s picture

thanks, @woprrr

Option 1 is not a solution for me as it requires a manual configuration of the URL alias for every single node. Looking forward to the integration in FFM!

Chris Matthews’s picture

Status: Postponed » Needs work