定制 jaymeh/craft-currently-reading-widget 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jaymeh/craft-currently-reading-widget

最新稳定版本:1.0.4

Composer 安装命令:

composer require jaymeh/craft-currently-reading-widget

包简介

Widget which uses various book API's to showcase what you are currently reading.

README 文档

README

A Craft CMS plugin that displays your currently reading books in a beautiful slider widget. Supports multiple book data sources including OpenLibrary.

Features

  • Beautiful slider interface for displaying books
  • Multiple data source support (OpenLibrary, Mock API)
  • Customizable templates
  • Responsive design
  • Easy to extend with custom book APIs

Installation

  1. Open your terminal and go to your Craft project:
cd /path/to/project
  1. Then tell Composer to load the plugin:
composer require jaymeh/craft-currently-reading-widget
  1. In the Control Panel, go to Settings → Plugins and click the "Install" button for Currently Reading Widget.

Configuration

  1. Go to Settings → Plugins → Currently Reading Widget
  2. Select your preferred book data source (OpenLibrary or Mock API)
  3. Configure any additional settings specific to your chosen data source

Customization

Overriding Templates

You can override the default templates by creating your own versions in your Craft project:

  1. Create a directory in your project:
templates/currently-reading/
  1. Copy the template files from the plugin's templates/currently-reading/ directory to your project's directory.

  2. Modify the templates as needed. Available templates:

  • slider.twig - Renders books in a slider template

Customizing Styles

The plugin's styles can be customized in two ways:

  1. Override the CSS file: Create your own CSS file in your project and override the plugin's classes:

    .currently-reading-widget__slider {
        /* Your custom styles */
    }
  2. Add custom classes: The plugin's templates use BEM-style class names that you can extend or override in your own CSS.

Extending with Custom APIs

You can add your own book data source by:

  1. Creating a new class that implements BookServiceInterface
  2. Registering your API in the RegisterBookApiEvent event:
use jaymeh\craftcurrentlyreadingwidget\events\RegisterBookApiEvent;

Event::on(
    BookApiService::class,
    RegisterBookApiEvent::class,
    function(RegisterBookApiEvent $event) {
        $event->apis['myapi'] = MyCustomApi::class;
    }
);

Available Template Variables

In the slider template, you have access to the following variables:

  • books - Array of book objects with properties:
    • title - Book title
    • author - Book author
    • coverImageUrl - URL to book cover image

Support

For support, please open an issue in the GitHub repository or contact the plugin author.

License

This plugin is licensed under the Craft License.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: proprietary
  • 更新时间: 2025-03-25