Overview

This module simply adds a filter for facebook embed posts.

Similar to BBCode you have to insert [facebook_embed=FACEBOOK_POST_URL] into your text field
and the filter replaces it with the embed markup.

This module works standalone (loading facebooks js sdk itself) or with fb_social. When fb_social is installed facebook_embed will not load the facebook js sdk itself. This avoids two sdk on the same page.

Screenshots:

Editor view: (There is an old version of the input code. Its "=" not ":")
facebook_embed_editor.png
Frontend view:
facebook_embed_title.png

Details

Project page: https://drupal.org/sandbox/valkum/2114399
Checkout: git clone --branch 7.x-1.x http://git.drupal.org/sandbox/valkum/2114399.git facebook_embed

Comments

PA robot’s picture

Status: Needs review » Needs work

There are some errors reported by automated review tools, did you already check them? See http://pareview.sh/pareview/httpgitdrupalorgsandboxvalkum2114399git

We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)

Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).

I'm a robot and this is an automated message from Project Applications Scraper.

valkum’s picture

Status: Needs work » Needs review

Just updated the doc comments to apply to Drupals Coding Standard

behestee’s picture

Status: Needs review » Needs work

Manual Review:

I have found some problems when I have installed the module, those are as follows:

  1. After install the module the configure link doesn't work from module listing page. This is because you put the wrong URL for configure in the .info file. Correct URL will be configure = admin/structure/facebook_embed
  2. It adds the FBJS before end of the body tag but it doesn't works. I have added the FBJS within the post then it works.
  3. Readme file is very simple, please try to add more details. Please try to mention to enable your filter in the text formats. Mention this in installation process or configuration section of your readme file
  4. In configuration page on admin section there is an error message showing. There was in issue with fetching Facebooks locales. Please try again later. I do not understand why this shows and what to do. Please clarify this in you message or readme file or in help section.
  5. Is it possible to show a loading image or something when post is loading? I think you can put the loading image inside the div which is rendered by your filter. This will be replaced by FBJS when the post is placed.

There are very few minor issues here reported the automated review tool, please see here: http://pareview.sh/pareview/httpgitdrupalorgsandboxvalkum2114399git and try to fix them.

Everything else looks very fine to me. If there is no existing module like this then it is good one.

Thanks

behestee’s picture

Issue summary: View changes

Shrinked images.

valkum’s picture

Issue summary: View changes
Status: Needs work » Needs review

Thanks @behestee for your feedback.

1. I fixed the configure link.
2. Works fine for me with this added to bottom. Other modules use this method too. Don't know what happend on your site.
3. & 4. I added infos about installation and the error shown on settings page to README.txt
You have to map your drupal locale to facebooks locales. en_EN or de_DE for example. Drupal has to fetch the list of locales supported by facebook. For this your drupal installation needs the ability to use succesful call drupal_http_request().
5. I tried this but it seems that facebooks jssdk only renders div.fb-post with empty inner html.
So there is no easy way to do this. Will add this as a feature request as i got some ideas to solve this.

valkum’s picture

Issue summary: View changes
neerajskydiver’s picture

StatusFileSize
new881 bytes

Reviewed the module using coder & Grammar Parser

Error report shows -

facebook_embed.admin.inc

severity: criticalreview: security_fapi_title
Line 25: Potential problem: FAPI elements '#title' and '#description' only accept filtered text, be sure to use check_plain(), filter_xss() or similar to ensure your $variable is fully sanitized. (Drupal Docs) [security_fapi_title]
      '#title' => 'Mapping for ' . check_plain($language->name) . ' (' . check_plain($language->language) . ')',

This can be fixed using attached patch [security_fapi_title-2114771.patch]. Otherwise code looks clean.

idebr’s picture

Status: Needs review » Needs work

Hey valkum,

I really like Facebook Embed, well done! Just a few points I think should be done before you release it:

  1. As pointed out by neerajskydiver in #6, there is an issue with the title in the admin interface. Always use the t() function in printed text, so you module can be localized to other languages and it even checks the output for security vulnerabilities for you! You can solve this by changing it to '#title' => t('Mapping for @language_name (@language_language', array('@language_name' => $language->name, '@language_language' => $language->language)),
  2. Your filter should be more explicit about its functionality. Take for example Video Filter: 'Substitutes [video:URL] with embedded HTML.'. I suggest changing 'This input filter allows users to drop in links to public facebook posts and have them automatically transformed into an Embedded Post.' to 'Substitutes [facebook_embed=URL] into an Embedded Post.'
  3. There is no feedback for editors how to use the filter. Can you add a formatting instruction with callback_filter_tips
valkum’s picture

Status: Needs work » Needs review

Thanks @neerajskydiver i applied your patch.
And thanks @idebr. I included your suggestions in the newest commits.

kscheirer’s picture

Status: Needs review » Reviewed & tested by the community
Master Branch
It appears you are working in the "master" branch in git. You should really be working in a version specific branch. The most direct documentation on this is Moving from a master branch to a version branch. For additional resources please see the documentation about release naming conventions and creating a branch in git.

Otherwise looks pretty good. The fb_social check is a little odd, but I assume it works.

----
Top Shelf Modules - Crafted, Curated, Contributed.

valkum’s picture

In the Master branch is only the readme for Information that the working branch is 7.x-1.x

behestee’s picture

See no 6 at Moving from a master branch to a version branch. So better you remove the master branch from your repo. And be sure you've set the appropriate default branch as directed before you delete master entirely.

kscheirer’s picture

Status: Reviewed & tested by the community » Fixed
  • You should remove the master branch, it's not needed anymore.
  • If the screenshot is outdated, can you post a correct one?
  • That facebook_embed_page_alter() is pretty ugly - could you use the Libraries API instead to make sure the library is loaded? Or a hook_requirements() to see if it's present? Generally modules try to have a local version of the js library, so it can be compressed and aggregated, as well as preventing another http request to FB.

None of those are blocking issues though, and it's been more than a month without any problems reported.

Thanks for your contribution, valkum!

I updated your account to let you promote this to a full project and also create new projects as either a sandbox or a "full" project.

Here are some recommended readings to help with excellent maintainership:

You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and get involved!

Thanks, 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.

Thanks to the dedicated reviewer(s) as well.

----
Top Shelf Modules - Crafted, Curated, Contributed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

corbin’s picture

Hello,
I think I didn't forget anything, but here is what i get with :
[facebook_embed=https://www.facebook.com/xxx/posts/xxxx]

as i am using CKEditor:
- nothing with "plain text" or "filtered HTML" or "Full HTML" when I activate "Facebook Embed Filter " (other filters disactivated)
- [facebook_embed=https://www.facebook.com/xxx/posts/xxxx] when "Facebook Embed Filter " is disactivated

Desertgirl’s picture

Hi,

I am trying to make this module work. In the example image above, the body shows a URL for a facebook posting. I don't understand where that code comes from. I have a bunch of data that I want to re-post from FB. If I visit a certain group's page, there are many postings of course, so I never see a URL as indicated above.

I've also been trying to get Facebook's embed code to work--I found the URL in the embed code and stripped out everything else. Then I structured it as in the image above:

[facebook_embed:https://www.facebook.com/photo.php?fbid=630580583646202]

AND

[facebook_embed:https://www.facebook.com/photo.php?fbid=630580583646202&set=a.1354666498..." data-width="466"]

Neither one works for me.

I am so happy to find this module as it was exactly what I was looking for--if I can get it to work for me.

Thanks!

Desertgirl’s picture

Update:

I neglected to say what I mean by 'doesn't work'. It just displays the embed code from the posting or, depending on which filter I choose, will display nothing.

Then, in configuration/text formats I found a 'Facebook Embed' filter. I was overjoyed, and went back to the node, and chose "embed filter" from the dropdown (instead of filtered or html) but I still got the same result.

The best result I got was with 'filtered html' which showed a link back to the facebook group who posted the content, but it didn't actually show the content itself.

I would be so grateful for some advice. This would be a lifesaver for my website. Thanks!

valkum’s picture

So as i changed the Project into an full project, please post further issues to the issue queue of the project (https://drupal.org/project/facebook_embed)

@corbin: I opened an issue at https://drupal.org/node/2198751 Can you provide some more information? HTML Source Code, JS Errors or similar information.

@Desergril: Maybe you got the same problem as corbin, please check out https://drupal.org/node/2198751 and maybe post some more information too.