manuxi/sulu-news-bundle 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

manuxi/sulu-news-bundle

最新稳定版本:2.0.1

Composer 安装命令:

composer require manuxi/sulu-news-bundle

包简介

Say hello to Sulu news!

README 文档

README

php workflow symfony workflow License: MIT GitHub Tag Supports Sulu 2.6 or later

I made this bundle to have the possibility to manage news in my projects without the dependency to elasticsearch. Over time, more and more features have been added.

This bundle contains

  • Several filters for News Content Type
  • Link Provider
  • Sitemap Provider
  • Handler for Trash Items
  • Handler for Automation
  • Possibility to assign a contact as author
  • Twig Extension for resolving news / get a list of news
  • Events for displaying Activities
  • Search indexes
    • refresh whenever entity is changed
    • distinct between published and draft and more...

The news and their meta information is translatable.

It contains an example twig template.

Please feel comfortable submitting feature requests. This bundle is still in development. Use at own risk 🤞🏻

image

👩🏻‍🏭 Installation

Install the package with:

composer require manuxi/sulu-news-bundle

If you're not using Symfony Flex, you'll also need to add the bundle in your config/bundles.php file:

return [
    //...
    Manuxi\SuluNewsBundle\SuluNewsBundle::class => ['all' => true],
];

Please add the following to your routes_admin.yaml:

SuluNewsBundle:
    resource: '@SuluNewsBundle/Resources/config/routes_admin.yaml'

Don't forget fo add the index to your sulu_search.yaml:

add "news_published"!

"news_published" is the index of published, "news" the index of unpublished elements. Both indexes are searchable in admin.

sulu_search:
    website:
        indexes:
            - news_published
            - ...

Last but not least the schema of the database needs to be updated.

Some tables will be created (prefixed with app_):
news, news_translation, news_seo, news_excerpt (plus some ManyToMany relation tables).

See the needed queries with

php bin/console doctrine:schema:update --dump-sql

Update the schema by executing

php bin/console doctrine:schema:update --force

Make sure you only process the bundles schema updates!

🎣 Usage

First: Grant permissions for news. After page reload you should see the news item in the navigation. Start to create news. Use smart_content property type to show a list of news, e.g.:

<property name="newslist" type="smart_content">
    <meta>
        <title lang="en">News</title>
        <title lang="de">News</title>
    </meta>
    <params>
        <param name="provider" value="news"/>
        <param name="max_per_page" value="5"/>
        <param name="page_parameter" value="page"/>
    </params>
</property>

Example of the corresponding twig template for the news list:

{% for news in newslist %}
    <div class="col">
        <h2>
            {{ news.title }}
        </h2>
        <h3>
            {{ news.subtitle }}
        </h3>
        <p>
            {{ news.created|format_datetime('full', 'none', locale=app.request.getLocale()) }}
        </p>
        <p>
            {{ news.summary|raw }}
        </p>
        <p>
            <a class="btn btn-primary" href="{{ news.routePath }}" role="button">
                {{ "Read more..."|trans }} <i class="fa fa-angle-double-right"></i>
            </a>
        </p>
    </div>
{% endfor %}

Since the seo and excerpt tabs are available in the news editor, meta information can be provided like it's done as usual when rendering your pages.

🧶 Configuration

This bundle contains settings for controlling the following tasks:

  • Settings for single view - Toggle for header, default hero snippet and breadcrumbs
  • Landing pages for breadcrumbs: this can be used to configure the intermediate pages for the breadcrumbs

👩‍🍳 Contributing

For the sake of simplicity this extension was kept small. Please feel comfortable submitting issues or pull requests. As always I'd be glad to get your feedback to improve the extension :).

统计信息

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

GitHub 信息

  • Stars: 4
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-09-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固