承接 furbo/museum-plus-for-craft-cms 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

furbo/museum-plus-for-craft-cms

Composer 安装命令:

composer require furbo/museum-plus-for-craft-cms

包简介

Allows to import MuseumsPlus Collection data to Craft CMS and publish data.

README 文档

README

Allows to import MuseumsPlus Collection data to Craft CMS and publish data.

Screenshot

Requirements

This plugin requires Craft CMS 4.7 or later and php 8.1 or later.

Installation

To install the plugin, follow these instructions.

  1. Open your terminal and go to your Craft project:

     cd /path/to/project
    
  2. Then tell Composer to load the plugin:

     composer require furbo/museum-plus-for-craft-cms
    
  3. In the Control Panel, go to Settings → Plugins and click the “Install” button for MuseumPlus for CraftCMS.

Overview

MuseumPlus for CraftCMS automatically imports items from one or more collections and makes them available to Craft.

Features

  • Import M+ Data From Craft
  • Import Assets like mages or other files to a Craft File System
  • Use Craft Transforms to generate thumnails etc
  • Add additional fields to items
  • Show item details or filtered lists (filter by vocabulary, people, ...)
  • Include items in craft fulltext search
  • Automatically enrich data from AI (Google Gemini).

Configuration

Once the plugin is installed, you can configure it in the Craft Control Panel under Settings → MuseumPlus for CraftCMS. You will need to provide:

  • the MuseumPlus classifier
  • the hostname for the MuseumPlus API
  • the MuseumPlus API username
  • the MuseumPlus API password

After saving the settings you will see the list of collections you have access to: choose at least one collection and save the settings. You should also choose the filesystem where the media will be stored: note that the two subfolders Items and Multimedia will be automatically created in the root of the filesystem. You can specify which kind of files to import: the plugin will download the files and store them in the chosen filesystem. In the settings there is a section to define the URI format and template to be used to show collection items in the frontend.

The shell command ./craft museum-plus-for-craft-cms/collection/update-items will import the data from the selected collections. We advise to set up a cron job to run this command regularly.

Usage

In the backend you will see a new section called "Collection" where you can see the imported collections and their items

Frontend example to display the items:

{% set items = craft.museumPlus.items.all() %}
{% for item in items %}
    <h2>{{ item.title }}</h2>
    <p>{{ item.description }}</p>
    <img src="{{ item.image.getUrl() }}" alt="{{ item.title }}">
{% endfor %}

Frontend example to display a list of items filtered by vocabuilary ref:

{% set vocabulary = craft.museumPlus.getVocabularyById(id) %}
{% set items = vocabulary.getItems() %}
{% for item in items %}
    <h2>{{ item.title }}</h2>
    <p>{{ item.description }}</p>
    <img src="{{ item.image.getUrl() }}" alt="{{ item.title }}">
{% endfor %}

Frontend example to display a single item:

{% set item = craft.museumPlus.getItemById(id) %}
{% set attachment = item.getAttachment() %}
{% if attachment %}
    {% set myAssetUrl = attachment.getUrl() %}
    <img src="{{ attachment.getUrl("transformL") }}" alt="{{ attachment.title }}" />
{% endif %}
<h2>{{ item.title }}</h2>

Other methods available in twig:

craft.museumPlus.getItemById(id)
craft.museumPlus.getItemsByIds(ids)
craft.museumPlus.getVocabularies($type)
craft.museumPlus.getVocabularyById(id)
craft.museumPlus.getAllPeople()
craft.museumPlus.getPeopleById(id)
craft.museumPlus.getObjectGroupById(id)
craft.museumPlus.getAllObjectGroups()
craft.museumPlus.searchItems(params)

Methods available in on a item:

 - getAttachment // gets the main image / file
 - getMultimedia // gets other images / files
 - getObjectGroups // dito
 - getLiterature // dito
 - getOwnerships // dito
 - getAssociationPeople // dito
 - getOwnerPeople // dito
 - getAdministrationPeople // dito
 - getRelatedItems // gets the items related to this object
 - getVocabularyEntries // gets the vocabulary entries related to this item
 - getVocabularyEntriesByType(type) // gets the vocabulary entries related to this item filtered by type

Methods available in on a vocabulary entry:

 - getItems() // gets all ietms associted by this type
 - getParent() // get the parent vocabulary node
 - getParents() // get all parents up the tree
 - getPath() // get all parents up the tree plu sthe node itself

The getRecords methods gives acces to the underlying record element. Here the methods that can be called on the records (items, people, objectgroups, vocabulary entries, literature, ownerships)

 - getRepeatableGroupValues(groupName, attribute = null, filterTypes = [])
 - getDataAttributes() (for all)
 - getDataAttribute(name)

Get the items from objects like people, objectgroups, vocabulary entries, literature, ownerships

 - rec.getItems()

Events

The plugin throws a custom event after an item has been updated or created by the plugin.Custom modules can then listen to the event and add some custom functionality.

Add this code to the init() method of your custom module in craft cms.

Event::on(
    MuseumPlusForCraftCms::class,
    MuseumPlusForCraftCms::EVENT_ITEM_UPDATED_FROM_MUSEUM_PLUS,
    function(ItemUpdatedFromMuseumPlusEvent $e) {
        //Example: lets say you have an extra field, for example is_new to show alle the newly created items in a collection.
        //The field can the be removed manually from the backend
        $item = $e->item;
        if ($e->isNewItem) {
          $item->is_new = true;
          Craft::$app->elements->saveElement($item);
        }
    }
);

Roadmap

  • add geo refs via google to items

Brought to you by Furbo GmbH

furbo/museum-plus-for-craft-cms 适用场景与选型建议

furbo/museum-plus-for-craft-cms 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 24 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 06 月 13 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「cms」 「Craft」 「craftcms」 「craft-plugin」 「museumplus」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 furbo/museum-plus-for-craft-cms 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 furbo/museum-plus-for-craft-cms 我们能提供哪些服务?
定制开发 / 二次开发

基于 furbo/museum-plus-for-craft-cms 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: proprietary
  • 更新时间: 2024-06-13