Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update page handler scripts for cases in which the entity container isn't a user or group (Trac #4501) #4501

Closed
elgg-gitbot opened this issue Feb 16, 2013 · 6 comments

Comments

@elgg-gitbot
Copy link

Original ticket http://trac.elgg.org/ticket/4501 on 42342182-12-04 by trac user elmendavies, assigned to unknown.

Elgg version: 1.8

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:

http://localhost/blog/add/55

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

@elgg-gitbot
Copy link
Author

trac user elmendavies wrote on 42342194-02-22

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??

@elgg-gitbot
Copy link
Author

brettp wrote on 42342707-04-25

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/ 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");

}

@elgg-gitbot
Copy link
Author

Title changed from Journal plugin to Update page handler scripts for cases in which the entity container isn't a user or group by brettp on 42342707-04-25

@elgg-gitbot
Copy link
Author

Milestone changed to Near Term Future Release by ewinslow on 42365525-07-08

@elgg-gitbot
Copy link
Author

trac user mrclay wrote on 42596028-11-22

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

@elgg-gitbot elgg-gitbot reopened this Feb 17, 2013
@ewinslow
Copy link
Contributor

Closing as this doesn't currently seem feasible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants