Fasttoggle

Provides AJAX-powered one-click toggling of node and comment properties directly from content pages.

fasttoggle
692 sites
25
drupal.org

Install

Drupal 11, 10, 9, 8 v4.0.5
composer require 'drupal/fasttoggle:^4.0'

Overview

Fasttoggle is a Drupal module that simplifies and speeds up site administration by providing AJAX-based toggling of administrative settings and content values. Instead of navigating to edit forms to change common node properties like published status, promoted to front page, or sticky at top of lists, administrators can toggle these values with a single click directly from the content view page.

The module adds toggle links to node and comment operations, allowing quick status changes without page reloads. It supports configurable label styles - either showing the current state (e.g., "Published", "Promoted") or the action that will occur on click (e.g., "Unpublish", "Demote"). Each content type can be individually configured to enable or disable specific toggle options, providing granular control over which toggles are available for different content types.

Features

  • AJAX-powered one-click toggling of node publication status (published/unpublished)
  • AJAX-powered one-click toggling of node promotion to front page (promoted/not promoted)
  • AJAX-powered one-click toggling of node sticky status (sticky/not sticky)
  • AJAX-powered one-click toggling of comment publication status (published/unpublished)
  • Two configurable label styles: status-based labels showing current state or action-based labels showing what will happen on click
  • Per-content-type configuration allowing administrators to enable/disable specific toggles for each node type
  • Per-comment-type configuration for comment status toggling
  • Toggle links appear in node and comment operation links without page reload

Use Cases

Quick Content Moderation

Site editors managing a news site can quickly publish or unpublish articles directly from the node view page without navigating to the edit form. When reviewing content, they can click 'Publish' or 'Unpublish' links to immediately change the content status.

Front Page Content Management

Content managers can easily promote or demote content to the front page by clicking toggle links. This is useful for sites that feature content on the home page and need to quickly rotate which articles appear there.

Sticky Content for Important Announcements

When an important announcement needs to stay at the top of listing pages, administrators can click the 'Make sticky' link to pin the content. When it's no longer relevant, they can click 'Make not sticky' to remove it from the top position.

Comment Moderation

Comment moderators can quickly publish or unpublish individual comments directly from the node page where they appear. This speeds up the moderation workflow by eliminating the need to visit separate administration pages.

Bulk Content Review Workflow

When reviewing multiple pieces of content, administrators can quickly toggle various properties as they scan through content pages, making the review process more efficient than editing each node individually.

Tips

  • Enable only the toggles you actually need for each content type to keep the interface clean and prevent accidental changes
  • Consider using Action-based label style (option 1) for a more intuitive user experience - users immediately see what clicking will do
  • Remember that Fasttoggle links appear in the node links area, which may be themed differently depending on your theme
  • The module works with Drupal's permission system, so you can grant 'use fasttoggle' permission to specific roles like 'Content Editor' while keeping 'administer fasttoggle' limited to administrators
  • Toggle actions are performed via AJAX, providing instant feedback without page reload, but the changes are immediately saved to the database

Technical Details

Admin Pages 3
Fasttoggle Settings /admin/config/system/fasttoggle

Configure the global settings for Fasttoggle, specifically the label style that determines how toggle links are displayed to users.

Content Type Edit Form - Fasttoggle Settings /admin/structure/types/manage/{node_type}

Each content type edit form includes a Fasttoggle vertical tab where administrators can enable or disable specific toggle options for that content type. This allows fine-grained control over which content types support which toggle actions.

Comment Type Edit Form - Fasttoggle Settings /admin/structure/comment/manage/{comment_type}

Each comment type edit form includes a Fasttoggle vertical tab where administrators can enable or disable the status toggle for comments of that type.

Permissions 2
Administer Fasttoggle

Allows access to the Fasttoggle settings page at /admin/config/system/fasttoggle to configure label style preferences.

Use Fasttoggle

Allows users to see and use the toggle links on nodes and comments. Users with this permission can toggle publication status, promotion, and sticky status of content directly from content pages.

Hooks 5
hook_node_links_alter

Adds Fasttoggle action links to node operation links based on content type settings

hook_comment_links_alter

Adds Fasttoggle action links to comment operation links based on comment type settings

hook_form_node_type_edit_form_alter

Adds Fasttoggle configuration options to the node type edit form as a vertical tab with checkboxes for enabling status, promote, and sticky toggles

hook_form_comment_type_edit_form_alter

Adds Fasttoggle configuration options to the comment type edit form as a vertical tab with a checkbox for enabling the status toggle

hook_help

Displays the README.md content on the module help page

Troubleshooting 4
Toggle links are not appearing on nodes

Ensure that: 1) The user has the 'use fasttoggle' permission, 2) The specific content type has Fasttoggle options enabled in the content type settings (Administration > Structure > Content Types > [Type] > Edit), 3) Clear the cache after making configuration changes.

Toggle links are not appearing on comments

Ensure that: 1) The user has the 'use fasttoggle' permission, 2) The comment type has the status toggle enabled (Administration > Structure > Comment Types > [Type] > Edit), 3) Clear the cache after making configuration changes.

AJAX toggle not working, page refreshes instead

Verify that Drupal's AJAX library is loading correctly and there are no JavaScript errors in the browser console. The toggle links use the 'use-ajax' class which requires Drupal's core AJAX functionality.

Labels showing wrong style

Navigate to Administration > Configuration > System > Fasttoggle and verify the label style setting. Style 0 shows current status (e.g., 'Published'), while style 1 shows the action (e.g., 'Unpublish').

Security Notes 4
  • The module uses Drupal's permission system - only users with 'use fasttoggle' permission can execute toggle actions
  • Toggle actions modify entity status, promotion, and sticky values, which could affect site visibility and content display
  • Consider carefully which roles should have the 'use fasttoggle' permission, as it allows quick changes to content publication status
  • The 'administer fasttoggle' permission should be limited to trusted administrators who understand the implications of label style settings