Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Entity Form Cancel Button

Security covered Maintenance fixes only 3,344 sites

This module adds a cancel button to entity forms. The button intelligently redirects the user to an appropriate previous page, such as the entity's view page, a list of entities, or the page they came from, based on context and configuration.

The Cancel Button module allows site administrators to enable a cancel button on entity forms.

The destination where the cancel button takes the user varies based on the context.

  • If the form itself has a redirect set internally (through FormState::setRedirect(), often used in form submit handler code), the cancel button will direct the user to the form's redirect destination.
  • If there is no internal form redirect in the form's submit handler code, but there is a destination parameter in the URL (https://www.example.com/node/1/edit?destination=/admin/content), the cancel button will direct the user to the path in the destination URL parameter.
  • If there is no destination parameter in the URL, and this is the standalone edit form page for the entity (for example, https://www.example.com/node/1/edit), the cancel button will direct the user to one of the following pages, in this order of precedence:
    • If the entity has a canonical page defined (a standalone 'view' page for the entity, for example https://www.example.com/node/1), then the cancel button will direct the user there.
    • If a canonical page for the entity cannot be found, but the entity type has a 'collection' page defined (for example, https://www.example.com/admin/structure/types for a Content Type configuration entity), then the cancel button will direct the user to the collection page.
    • If there is neither a canonical page nor a collection page available for the entity, and the form is for a field configuration, then the cancel button will direct the user to page that lists the fields for the bundle on which the current field appears.
  • If none of the above are available, the module looks at the Referer in the HTTP headers to see which page the user was viewing prior to accessing the form.
  • If there is no HTTP Referer available (for example, if the user typed the URL to the form directly into the browser, or accessed the form from a browser bookmark), then the user is directed to default cancel destination configured per entity type/bundle at /admin/config/content/cancel-button.
Drupal 8–11

Ask your assistant about Entity Form Cancel Button

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
2
Tracked since
Feb 2023
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 1
Maintenance
Active

Releases

Version Type Core PHP Release date
8.x-1.5 Stable 8–11 Nov 28, 2024
8.x-1.4 Stable 8–10 Feb 20, 2023