RSS embed field is a module that allows you to consume RSS feeds from any Link field. It's a more light-weight approach to the problem then using Feeds or Migrate API to write a full import process for the feed.
Project link
https://www.drupal.org/project/rss_embed_field
Git instructions
git clone --branch '8.x-1.x' https://git.drupalcode.org/project/rss_embed_field.git
Comments
Comment #2
gurjinder_pablaThere are few place where code is wrong, Have to use dependency injection instead of
\Drupal. And instead of t(), need to use$this->t()withuse \Drupal\Core\StringTranslation\StringTranslationTrait;FILE: /rss_embed_field/src/Tests/RssEmbedTest.php
----------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 3 WARNINGS AFFECTING 4 LINES
----------------------------------------------------------------------------------------------------------------------------------------------------
36 | ERROR | Do not disable strict config schema checking in tests. Instead ensure your module properly declares its schema for configurations.
135 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
136 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
144 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
----------------------------------------------------------------------------------------------------------------------------------------------------
FILE: /rss_embed_field/src/Plugin/Field/FieldFormatter/Rss.php
----------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------------------------------
108 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
----------------------------------------------------------------------------------------------
FILE: /rss_embed_field/src/RssFeedFetcher.php
----------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------------------------------
130 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
----------------------------------------------------------------------------------------------
Comment #3
jacobbell84 commentedHi gurjinder_pabla,
Thank you for taking the time to review the module code. I believe I've addressed your feedback and committed it back into the 8.x-1.x branch for review.
Comment #4
andrei.vesterliHello @jacobbell84
After the codebase investigation, I've found some moments to look at:
1.
file: web/modules/contrib/rss_embed_field/src/Plugin/Field/FieldFormatter/Rss.php
context: method viewElements()
issue: The use Reader::setExtensionManager($this->reader); may throw an issue due to the following log:
Expected type 'Laminas\Feed\Reader\ExtensionManagerInterface'. Found 'Laminas\Feed\Reader\Reader'
2.
file: web/modules/contrib/rss_embed_field/src/Plugin/Field/FieldFormatter/Rss.php
context: method sanitizeInput()
issue: @param string $allowed_tags. The param must not be described as a string because the web/core/lib/Drupal/Component/Utility/Xss.php has this definition public static function filter($string, array $html_tags = NULL), so, array or NULL. I think, if you'll use @param mixed $allowed_tags will be better.
3.
file: web/modules/contrib/rss_embed_field/src/RssFeedFetcher.php
suggestion: I do usually prefer to write an interface for a service. Your is a 100+ lines file and has several methods inside. I may have the potential to grow (in the future), so, It's just a suggestion/idea to provide a proper interface for it.
4.
file: web/modules/contrib/rss_embed_field/src/RssFeedFetcher.php
suggestion: It's better to provide the variable types for the method arguments like an example: public function fetch($source_url) > public function fetch(string $source_url) etc.
5.
file: composer.json
suggestion:
The rest seems to be pretty ok for me and you did a really good job!
Regards,
Andrei
Comment #5
jacobbell84 commentedThank you @andrei.vesterli! I've implemented the changes into the development branch.
Comment #6
andrei.vesterliNice!
Also, there is a missing LICENTE.txt file (at least GPL - GNU GENERAL PUBLIC LICENSE). See http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
Sorry that didn't mention that before.
Comment #7
andrei.vesterliComment #8
jacobbell84 commentedHi @andrei.vesterli,
It's my understanding that the LICENSE.TXT file is added by the system and isn't needed in the repository, since everything hosted in Drupal falls under the same license. Another entry had been flagged because they included it in their repository, for example: https://www.drupal.org/project/projectapplications/issues/3271971#commen...
Comment #9
andrei.vesterliAh...i got an issue on my module on this exact issue. Anyway, this is good to know! Thx for your input. Then, i have no issues. Who else can review it?
Comment #10
avpadernoThank you for your contribution! I am going to update your account.
These are some recommended readings to help with excellent maintainership:
You can find more contributors chatting on the Slack #contribute channel. So, come hang out and stay involved.
Thank you, also, for your patience with the review process.
Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.
I thank all the dedicated reviewers as well.