WP Manifestindependent plugin directory
manifest / editor / doc-library-block

Document Library Block

Extension of document library pro that provides a library block that wraps the dlp shortcode

by Barn2 Plugins · github.com/vanburencountymi-digital-information/doc-library-block

0stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/vanburencountymi-digital-information/doc-library-block/archive/refs/heads/main.zip

Barn2 Doc Library Block

Document Library Block

A Gutenberg block wrapper for the Document Library Pro shortcode with full attribute support.

Description

This plugin provides a Document Library Gutenberg block that wraps the [doc_library] shortcode from the Document Library Pro plugin. It exposes all shortcode attributes as block settings in the editor sidebar, making it easy to configure document libraries visually without writing shortcode syntax.

Requirements

  • WordPress 6.1 or higher
  • PHP 7.4 or higher
  • Document Library Pro plugin (required for functionality)

Features

  • Complete attribute support: All Document Library Pro shortcode attributes are supported
  • Visual editor interface: Configure all settings through the block sidebar
  • Layout options: Choose between table and grid layouts
  • Folder support: Enable hierarchical folder organization
  • Advanced filtering: Set up document categories, tags, and custom filters
  • Responsive design: Configure responsive breakpoints and display options
  • Preview support: Enable document preview functionality
  • Multi-download: Configure bulk download options
  • Custom styling: Support for custom folder icons and colors

Installation

  1. Upload the plugin files to /wp-content/plugins/barn2-doc-library-block/
  2. Activate the plugin through the 'Plugins' screen in WordPress
  3. Ensure Document Library Pro plugin is installed and activated
  4. Add the "Document Library" block to any post or page

Block Settings

The block provides comprehensive settings organized into logical panels:

Layout Settings

  • Layout: Choose table or grid display
  • Columns: Configure visible columns (table layout)
  • Grid Content: Select content to display (grid layout)
  • Grid Columns: Set number of columns for grid

Document Settings

  • Document Link: Enable/disable download links
  • Link Style: Choose button, icon, or text style
  • Preview: Enable document preview functionality
  • Multi-download: Configure bulk download options

Folder Settings

  • Enable Folders: Turn on hierarchical organization
  • Folder Ordering: Configure sort order
  • Folder Status: Set default open/closed state
  • Custom Icons: Use custom folder icons and colors

Display Settings

  • Search Box: Show/hide and position search
  • Pagination: Configure pagination display
  • Totals: Show document counts
  • Reset Button: Add filter reset functionality

Filter Settings

  • Document Categories: Filter by categories
  • Document Tags: Filter by tags
  • Document Authors: Filter by authors
  • Custom Filters: Set up advanced filtering

Content Settings

  • Content Length: Control excerpt length
  • Image Size: Set thumbnail dimensions
  • Date Format: Configure date display
  • Links: Make columns clickable

Development

Building the Block

npm install
npm run build

Development Mode

npm run start

This starts the development server with live reloading.

File Structure

  • src/barn2-doc-library-block/ - Block source files
    • block.json - Block metadata and attributes
    • edit.js - Block editor component
    • save.js - Block save function (returns null for dynamic block)
    • render.php - Server-side render callback
    • index.js - Block registration
    • editor.scss - Editor-only styles
    • style.scss - Front-end styles

Shortcode Mapping

The block attributes directly map to Document Library Pro shortcode attributes:

// Block attributes are converted to shortcode format
[doc_library layout="grid" content="image,title,link" folders="true"]

Error Handling

The block gracefully handles errors:

  • Shows warning if Document Library Pro is not installed
  • Displays error messages for rendering issues
  • Maintains block functionality even with invalid settings

Hooks and Filters

The block uses the same hooks and filters as the Document Library Pro shortcode, allowing for customization through existing plugin extensions.

Changelog

0.1.0

  • Initial release
  • Complete shortcode attribute support
  • Visual editor interface
  • Responsive design options
  • Grid and table layouts
  • Folder organization support

Support

For support with this block, please check:

  1. Document Library Pro plugin documentation
  2. WordPress block editor documentation
  3. Plugin support forums

License

MIT