{"id":21440904,"url":"https://github.com/pixel-open/sulu-newsbundle","last_synced_at":"2025-07-05T05:07:31.834Z","repository":{"id":65800301,"uuid":"595626985","full_name":"Pixel-Open/sulu-newsbundle","owner":"Pixel-Open","description":"A Sulu bundle to manage the news of your website.","archived":false,"fork":false,"pushed_at":"2025-06-24T19:23:00.000Z","size":90,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2025-06-24T20:31:12.688Z","etag":null,"topics":["sulu-bundle"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Pixel-Open.png","metadata":{"files":{"readme":"readme.md","changelog":"changelog.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-01-31T13:34:45.000Z","updated_at":"2025-06-24T19:22:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"2f3ee598-6d12-474b-a970-5ddadcb52199","html_url":"https://github.com/Pixel-Open/sulu-newsbundle","commit_stats":{"total_commits":38,"total_committers":2,"mean_commits":19.0,"dds":0.4473684210526315,"last_synced_commit":"a2b3a9406de8e04d4331d77ccbe591f72d24fd8e"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/Pixel-Open/sulu-newsbundle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pixel-Open%2Fsulu-newsbundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pixel-Open%2Fsulu-newsbundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pixel-Open%2Fsulu-newsbundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pixel-Open%2Fsulu-newsbundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Pixel-Open","download_url":"https://codeload.github.com/Pixel-Open/sulu-newsbundle/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pixel-Open%2Fsulu-newsbundle/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263687157,"owners_count":23496089,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["sulu-bundle"],"created_at":"2024-11-23T01:19:25.532Z","updated_at":"2025-07-05T05:07:31.828Z","avatar_url":"https://github.com/Pixel-Open.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sulu news bundle\n\n[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%208.0-green)](https://php.net/)\n[![Minimum Sulu Version](https://img.shields.io/badge/sulu-%3E%3D%202.6-green)](https://symfony.com)\n[![GitHub release](https://img.shields.io/github/v/release/Pixel-Open/sulu-newsbundle)](https://github.com/Pixel-Open/sulu-newsbundle/releases)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=Pixel-Open_sulu-newsbundle\u0026metric=alert_status)](https://sonarcloud.io/summary/new_code?id=Pixel-Open_sulu-newsbundle)\n\n## Presentation\nA Sulu bundle to manage the news of your website.\n\n## Requirements\n\n* Symfony \u003e= 5.4\n* Composer\n\n## Features\n* List view of News (smart content)\n* Without elasticsearch\n* Routing\n* Preview\n* SULU Media include\n* Content Blocks (Title,Editor,Image,Quote)\n* Activity Log\n* Trash\n* Automation\n* SEO\n\n## Installation\n\n### Install the bundle\n\nExecute the following [composer](https://getcomposer.org/) command to add the bundle to the dependencies of your\nproject:\n\n```bash\ncomposer require pixelopen/sulu-newsbundle\n```\n\n### Enable the bundle\n\nEnable the bundle by adding it to the list of registered bundles in the `config/bundles.php` file of your project:\n\n ```php\n return [\n     /* ... */\n     Pixel\\NewsBundle\\NewsBundle::class =\u003e ['all' =\u003e true],\n ];\n ```\n\n### Update schema\n```shell script\nbin/console do:sch:up --force\n```\n\n## Bundle Config\n\nDefine the Admin Api Route in `routes_admin.yaml`\n```yaml\nnews.news_api:\n  type: rest\n  prefix: /admin/api\n  resource: pixel_news.news_route_controller\n  name_prefix: news.\n```\n\n## Use\n### Add/Edit a news\nGo to the \"News\" section in the administration interface. Then, click on \"Add\".\nFill the fields that are needed for your use.\n\nHere is the list of the fields:\n* Title (mandatory)\n* URL (mandatory and filled automatically according to the title)\n* Published at (manually filled)\n* Cover\n* Category (mandatory)\n* Content\n\nThe \"Content\" field is a block content type. The different type of block come from the [Sulu Block Bundle](https://github.com/Pixel-Developpement/sulu-block-bundle)\n\nOnce you finished, click on \"Save\"\n\nYour news is not visible on the website yet. In order to do that, click on \"Publish?\". It should be now visible for visitors.\n\nTo edit a news, simply click on the pencil at the left of the news you wish to edit.\n\n### Categories\nAs you may have seen in the previous section, a news needs a category. These categories need to be created in a very specific way:\n* You **must** create a root category which **must** have its key named \"news\"\n* Then, under this root category, you create all the news categories you need\n\n### Remove/Restore a gallery\n\nThere are two ways to remove a news:\n* Check every news you want to remove and then click on \"Delete\"\n* Go to the detail of a news (see the \"Add/Edit a news\" section) and click on \"Delete\".\n\nIn both cases, the news will be put in the trash.\n\nTo access the trash, go to the \"Settings\" and click on \"Trash\".\nTo restore a news, click on the clock at the left. Confirm the restore. You will be redirected to the detail of the news you restored.\n\nTo remove permanently a news, check all the news you want to remove and click on \"Delete\".\n\n## Settings\n\nThis bundle comes with settings. There is only one setting, it's the configuration of a default image.\nTo access the bundle settings, go to \"Settings \u003e News management\".\n\n## Twig extension\nThere are several twig functions in order to help you use the news and settings on your website:\n\n**get_latest_news(limit, local)**: returns the latest news. It takes two parameters:\n* limit: represents the number of the latest news to display. If no limit is provided, the default value is 3\n* locale: the locale in which the news should be retrieved. If no local is provided, the default value is 'fr'\n\nExample of use:\n```twig\n\u003cdiv class=\"w-full flex flex-row gap-6 justify-between\"\u003e\n    {% set news = get_latest_news(4, app.request.locale) %}\n    {% for new in news %}\n        \u003cdiv class=\"containerAvis bg-white rounded-xl p-6 w-1/4\"\u003e\n            \u003ca href=\"{{ sulu_content_path(new.routePath) }}\" class=\"no-underline\"\u003e\n                {% if new.cover.id is defined %}\n                    {% set cover = sulu_resolve_media(new.cover.id, 'fr') %}\n                    \u003cimg src=\"{{ cover.thumbnails[\"991x\"] }}\" alt=\"{{ new.title }}\"\n                         class=\"w-full h-40 object-cover object-center bg-black mt-0 mb-4\"\u003e\n                {% endif %}\n                \u003ch3 class=\"block text-center text-base font-bold\"\u003e{{ new.title }}\u003c/h3\u003e\n                \u003cp class=\"block text-center\"\u003e{{ new.publishedAt|date(\"d/m/Y\") }} {#- {{ new.category }} #}\u003c/p\u003e\n            \u003c/a\u003e\n        \u003c/div\u003e\n    {% endfor %}\n\u003c/div\u003e\n```\n\n**get_latest_news_html(limit, locale)**: same as get_latest_news but it renders a view instead. It takes two parameters:\n* limit: represents the number of the latest news to display. If no limit is provided, the default value is 3\n* locale: the locale in which the news should be retrieved. If no local is provided, the default value is 'fr'\n\nExample of use:\n```twig\n\u003cdiv\u003e\n    {{ get_latest_news_html(4, app.request.locale) }}\n\u003c/div\u003e\n```\n\n**news_settings()**: returns the settings of the bundle. No parameters are required.\n\nExample of use:\n\n```twig\n{% set newsSettings = news_settings() %}\n{% if news.cover is not empty %}\n    {% set cover = sulu_resolve_media(news.cover.id, 'en' %}\n    \u003cimg src=\"{{ cover.thumbnails['991x'] }}\" alt=\"{{ news.name }}\"\u003e\n{% else %}\n    {% set default = sulu_resolve_media(newsSettings.defaultImage.id, 'en' %}\n    \u003cimg src=\"{{ default.thumbnails['991x'] }}\" alt=\"Default news image\"\u003e\n{% endif %} \n```\n\n## Contributing\nYou can contribute to this bundle. The only thing you must do is respect the coding standard we implement.\nYou can find them in the `ecs.php` file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpixel-open%2Fsulu-newsbundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpixel-open%2Fsulu-newsbundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpixel-open%2Fsulu-newsbundle/lists"}