Opened 13 months ago
Last modified 10 months ago
#4501 new Enhancement
Update page handler scripts for cases in which the entity container isn't a user or group
| Reported by: | elmendavies | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Near Term Future Release |
| Component: | Core | Version: | 1.8 |
| Severity: | minor | Keywords: | |
| Cc: | brett@… | Difficulty: | trivial |
Description
Hello,
I am creating a journal plugin where there is a group of editors that publish things and the journal is publicly accesible.
The main object is a journal (an ElggObject). The journal object is the container for many objects (ElggObject).
$journal = new ElggObject(); Should be an ElggGroup???
$journal->title = get_input('title', );
$journal->description = get_input('description',);
$journal->subtype = "journal";
$journal->access_id = 2;
$journal->save();
I have integrated the blog plugin which is perfect to publish things on the journals. I add new blogs to the journal doing:
Where 55 is the GUID of a journal object.
Am I using it correctly? In that case, the breadcrumb is not correctly written.
I proposed the following change:
In blog/lib/blog.php, line 40, add (or something similar):
if (elgg_instanceof($container, 'group')) {
elgg_push_breadcrumb($crumbs_title, "blog/group/$container->guid/all");
} else if (elgg_instanceof($container, 'object')) {
elgg_push_breadcrumb($container->title, $container->getSubtype() . "/view/$container->guid");
} else {
elgg_push_breadcrumb($crumbs_title, "blog/owner/$container->username");
}
And then the discussion began...
Post URL: http://community.elgg.org/pg/forum/topic/868740/blog-18-and-new-journals-plugin/
Should I implement the journal as a goup???
Best regards
Change History (4)
comment:1 Changed 13 months ago by elmendavies
comment:2 Changed 13 months ago by brettp
- Component changed from Blog to Core
- Difficulty set to trivial
- Summary changed from Journal plugin to Update page handler scripts for cases in which the entity container isn't a user or group
- Type changed from Feature Request to Enhancement
Some clarification: Trac is used for listing bugs, not for support requests. The community site is the right place for development support.
I've distilled the important part of this ticket below:
The developer uses blog/add/<guid> to add a blog to an ElggObject functioning as a generic container. This causes the view page handler for this entity to display wrong, most notably in the breadcrumbs. This simple change would require overriding every single page handler. Since any object can be a container, do we want to standardize this behavior?
Possible solution: In blog/lib/blog.php, line 40, add (or something similar):
if (elgg_instanceof($container, 'group')) {
elgg_push_breadcrumb($crumbs_title, "blog/group/$container->guid/all");
} else if (elgg_instanceof($container, 'object')) {
elgg_push_breadcrumb($container->title, $container->getSubtype() . "/view/$container->guid");
} else {
elgg_push_breadcrumb($crumbs_title, "blog/owner/$container->username");
}
comment:3 Changed 12 months ago by ewinslow
- Milestone changed from Needs Review to Near Term Future Release
comment:4 Changed 10 months ago by mrclay
I fear that trying to truly support arbitrary entities as containers in core will lead to a complex mess of cases to consider and code around. Even the proposed fix has to assume that the arbitrary object will have a page handler that matches our convention; there's no way to know this.
Is there a hook triggered before the breadcrumb is rendered? The plugin could rewrite the links in a central location. Otherwise we need to think about a framework for reverse routing, like entity_url_handler for listing pages...

I have checked the groups plugin. I could use the 'group' type and subtype it 'journal'. I think I would follow elgg philosophy better. In that case, the journal would appear in the list of groups (Not complettely what I spected).
Does any expert have any recommendation about how to begin?
Should we see it as a improvement in the Blogss plugin or it is more a concept mismatch??