onedesign/autopop

帮助自动填充条目内容。

安装: 300

依赖: 0

建议者: 0

安全: 0

星标: 0

关注者: 4

分支: 0

开放问题: 0

类型:craft-plugin

1.0.1 2018-03-06 16:24 UTC

This package is auto-updated.

Last update: 2024-09-24 04:55:39 UTC


README

帮助自动填充条目内容。

要求

此插件需要Craft CMS 3.0.0-RC1或更高版本。

安装

要安装此插件,请按照以下说明操作。

  1. 打开您的终端并进入您的Craft项目

     cd /path/to/project
    
  2. 然后告诉Composer加载插件

     composer require onedesign/autopop
    
  3. 在控制面板中,转到设置 → 插件,并为Autopop点击“安装”按钮。

使用

{# The initial entries to start with #}
{% set entries = craft.entries.section('news') %}

{# Returns an Element Query that includes all entries NOT in the `featuredNews` field for the passed `entry` #}
{% set populatedEntries = craft.autopop.entries({
  entries: entries,
  entry: entry,
  excludeFields: ['featuredNews']
}) %}

{# You can continue to refine this set by passing in additional arrays of entry `excludeIds` to exclude. #}
{% set populatedEntries = craft.autopop.entries({
  entries: populatedEntries,
  excludeIds: [5, 13]
}) %}

{# If you have an Entries field that may not have all of it's entries set, you can also easily "fill" all of the slots in that field. NOTE: You can't currently pass entries populated using autopop.fillField() through another autopop.entries(), because autopop.fillField() returns an Element Query with specific entry ids. Either make autopop.fillField() the last thing you pass entries through, or use in place of autopop.entries() #}
{% set filledEntries = craft.autopop.fillField({
  entries: populatedEntries,
  field: entry.featuredEntries,
  excludeIds: []
}) %}

One Design Company提供