Drupal is a registered trademark of Dries Buytaert
drupal 10.6.8 Update released for Drupal core (10.6.8)! drupal 11.3.9 Update released for Drupal core (11.3.9)! drupal 11.3.8 Update released for Drupal core (11.3.8)! drupal 11.3.7 Update released for Drupal core (11.3.7)! drupal 11.2.11 Update released for Drupal core (11.2.11)! drupal 10.6.7 Update released for Drupal core (10.6.7)! drupal 10.5.9 Update released for Drupal core (10.5.9)! cms 2.1.1 Update released for Drupal core (2.1.1)! drupal 11.3.6 Update released for Drupal core (11.3.6)! drupal 10.6.6 Update released for Drupal core (10.6.6)! cms 2.1.0 Update released for Drupal core (2.1.0)! linkit 7.0.14 Minor update available for module linkit (7.0.14). migrate_tools 6.1.4 Minor update available for module migrate_tools (6.1.4). diff 2.0.0 Major update available for module diff (2.0.0). masquerade 8.x-2.2 Minor update available for module masquerade (8.x-2.2). video_embed_field 3.1.0 Minor update available for module video_embed_field (3.1.0). bootstrap 8.x-3.40 Minor update available for theme bootstrap (8.x-3.40). menu_link_attributes 8.x-1.7 Minor update available for module menu_link_attributes (8.x-1.7). colorbox_inline 2.1.1 Minor update available for module colorbox_inline (2.1.1). node_view_permissions 8.x-1.7 Minor update available for module node_view_permissions (8.x-1.7).

Adds per-user pinning and flagging columns to Views table displays via htmx, with a pluggable row-action plugin type.

What it does

Adds an extra column to any Views table display that lets each logged-in user pin rows (so pinned rows float to the top on subsequent visits) and flag rows (a private bookmark for finding them later). The toggle uses htmx for instant, no-reload swaps, and per-user state persists across sessions.

The actions are pluggable: this module ships with Pin and Flag, but any contrib or custom module can register more (Bookmark, Follow, Hide, …) by exposing a single ViewsRowAction plugin class — they show up in the per-display settings checkbox list automatically.

Not related to the Flag contrib module — this module ships its own lightweight per-user storage (a single views_table_pinflag_state table) and has no dependency on Flag. The two can coexist.

Why this approach

It's a custom Views style plugin that extends core's Table — drop-in compatible with every existing table display. Switch the format from Table to Table (with pin / flag), save, and the column appears. Sortable columns, sticky header, grouping, captions — all native Views features keep working.

Features

  • Per-display configuration: choose enabled actions, column position (left or right), custom CSS class, sort-pinned-first toggle, and an optional column header label.
  • Site-wide defaults (optional) at /admin/config/user-interface/views-table-pinflag so multiple displays can inherit a single setting.
  • htmx-powered toggles with hx-post, CSRF-protected route, and entity view-access check on every request.
  • Cache strategy uses the per-(user, action) cache tag pattern: toggling invalidates only that user's view, never the entity's own render cache.
  • Anonymous users see no column (nothing to persist against).
  • State is scoped per (view, display) — pinning a node in one view does not pin it in another, so each list stays independently curated.
  • Idempotent storage in a single views_table_pinflag_state table keyed on (uid, action_id, view_id, display_id, entity_type, entity_id).
  • Pluggable plugin type — third-party row actions are discovered automatically and appear in the settings UI.

Requirements

  • Drupal ^10.3 || ^11
  • htmx module (provides the htmx library)
  • An entity-based view (rows must expose _entity or have a base table mapping to an entity type — covers nodes, users, taxonomy terms, custom entities, etc.)

Installation

composer require drupal/views_table_pinflag
drush pm:install views_table_pinflag
drush cr

Configuration

  1. Edit any view with a table display.
  2. Click Format → Table and switch to Table (with pin / flag).
  3. Pick which actions to enable, the column position, and any custom class for theming.
  4. Save the view.

Permissions

  • Use Views table pin/flag actions — required to see and toggle the column.
  • Administer Views Table Pin/Flag — access the global defaults form.

Extending

Define a class in your_module/src/Plugin/ViewsRowAction/Bookmark.php:

#[ViewsRowAction(
  id: 'bookmark',
  label: new TranslatableMarkup('Bookmark'),
  label_activate: new TranslatableMarkup('Bookmark row'),
  label_deactivate: new TranslatableMarkup('Remove bookmark'),
  icon: '<svg …>…</svg>',
  weight: 5,
)]
class Bookmark extends RowActionBase {}

After a cache rebuild, Bookmark appears in every Pinflag table's enabled-actions checkboxes.

Limitations & Roadmap

  • "Sort pinned first" is current-page only; cross-page DB-level sort needs a Views query alter (planned).
  • Rows without a resolvable entity render an empty cell (column position and custom class still apply, so the table layout doesn't shift).
  • Planned: an exposed "show only mine" filter, Views Bulk Operations integration, cross-page DB sort via query alter.

Activity

Total releases
1
First release
May 2026
Latest release
4 days ago
Release cadence
Stability
100% stable

Releases

Version Type Release date
1.0.0 Stable May 9, 2026