borrowed publication with news posts containing images

17 views
Skip to first unread message

Brian Jones

unread,
Dec 1, 2010, 10:40:49 AM12/1/10
to Reason Discussion
Hi,

Have a minisite that contains a publication on a page that displays a
list of news posts including title, teaser image, and teaser text.
(See www.luther.edu/headlines).

Another minisite has borrowed the above publication and all displays
as before except the image, which does not display at all. By removing
$this->site_id from the entity selector on line 2151 of publication/
module.php the image appears in the borrowed publication. Don't know
if this behavior is by design or not but have overridden the
get_teaser_image function for our case.

Brian


function get_teaser_image($item)
{
$es = new entity_selector( );
$es->description = 'Finding teaser image for news item';
$es->add_type( id_of('image') );
$es->add_right_relationship( $item->id(),
relationship_id_of('news_to_teaser_image') );
$es->set_num (1);
$result = $es->run_one();
return $result;
}

Matt Ryan

unread,
Dec 2, 2010, 2:41:21 PM12/2/10
to reason-d...@googlegroups.com
Hi, Brian --

Good catch. I will take a look at it; if you're correct (and I suspect
you are) I will make that change in the core.

Matt

> --
> You received this message because you are subscribed to the Google Groups "Reason Discussion" group.
> To post to this group, send email to reason-d...@googlegroups.com.
> To unsubscribe from this group, send email to reason-discuss...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/reason-discussion?hl=en.
>
>

Matt Ryan

unread,
Dec 2, 2010, 4:11:06 PM12/2/10
to reason-d...@googlegroups.com
Brian, I think that your solution is good. I did add one "set_env"
call, which future-proofs the code a little bit, but otherwise your
suggestion is now in the core. You can update to the latest nightly if
you'd like, or you can replace that function with this:

function get_teaser_image($item)
{
$es = new entity_selector();
$es->description = 'Finding teaser image for news item';

$es->set_env( 'site' , $this->site_id );


$es->add_type( id_of('image') );
$es->add_right_relationship( $item->id(),
relationship_id_of('news_to_teaser_image') );
$es->set_num (1);
$result = $es->run_one();
return $result;
}

-- Matt

Reply all
Reply to author
Forward
0 new messages