Skip to content
This repository has been archived by the owner on Apr 20, 2023. It is now read-only.

Add Slideshow to Cover #130

Closed
sadiefp opened this issue Jun 23, 2016 · 2 comments
Closed

Add Slideshow to Cover #130

sadiefp opened this issue Jun 23, 2016 · 2 comments
Assignees

Comments

@sadiefp
Copy link

sadiefp commented Jun 23, 2016

I told my boss that we cannot add a slideshow to the cover of an Instant Article, based on the documentation I found online & the cover type enforcement in the SDK. Based on these sources, images & video are the only allowable covers.

https://developers.facebook.com/docs/instant-articles/guides/articlecreate#specify-cover
https://developers.facebook.com/docs/instant-articles/reference/cover#options
https://github.com/facebook/facebook-instant-articles-sdk-php/blob/master/src/Facebook/InstantArticles/Elements/Header.php#L103

But he found instant articles with slideshows as covers on Wired.
Wired's code:
https://github.com/whyisjake/Simple-Instant-Articles-for-Facebook/blob/db9651d2c9925b4fb0cced0861fb684fa0528bcd/templates/article-cover.php
An example Wired post with a slideshow cover:
https://www.facebook.com/wired/posts/10153790809838721

If I manually update an instant article, moving the slideshow figure into the header, facebook doesn't throw any errors. Playing with the SDK locally, if I add Slideshow to the allowable types for the cover, the slideshow is added with no issue to the header. If Slideshow's aren't allowed in the header, why don't I get any errors when I manually add them? Is this a fault on Facebook's documentation? Is a slideshow basically an image?

Steps required to reproduce the problem

  1. Try to add a slideshow as a cover:
$instant_article->getHeader()->withCover($slideshow);

Expected Result

  • Slideshow added to the <header>.
    <article>
      <header>
        <figure class="op-slideshow">
          <figure>
            <img src="http://example.com/image1.jpg"/>
            <figcaption>Caption caption caption...</figcaption>
          </figure>
          [...]
      </figure>
      <h1>Example Title</h1>
      [...]         
     </header>
     [...]
  </article>

Actual Result

  • Error
Additional uncaught exception thrown while handling exception.

InvalidArgumentException: Method expects this value ----[ object(Facebook\InstantArticles\Elements\Slideshow)#587 (5) { [...] } ]---- to be one of the types ====[ array(2) { 
[0]=> string(39) "Facebook\InstantArticles\Elements\Image"
 [1]=>string(39) "Facebook\InstantArticles\Elements\Video" 
} ]==== in Facebook\InstantArticles\Validators\Type::throwException() (line 182 of /var/www/drupalvm/sites/all/vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Validators/Type.php).
@everton-rosario
Copy link
Contributor

@sadiefp Can you check if it fixes your issue?

@sadiefp
Copy link
Author

sadiefp commented Jun 24, 2016

It worked for me.

Thanks for the quick response!

everton-rosario added a commit that referenced this issue Jun 24, 2016
Fix #130. Adds support to slideshow on the header
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants