Skip to content

Additional fields available to display in Contact Articles#14671

Closed
AndySDH wants to merge 2 commits intojoomla:stagingfrom
AndySDH:staging
Closed

Additional fields available to display in Contact Articles#14671
AndySDH wants to merge 2 commits intojoomla:stagingfrom
AndySDH:staging

Conversation

@AndySDH
Copy link
Contributor

@AndySDH AndySDH commented Mar 16, 2017

Right now, the Contact Articles (articles written by an author) View (com_contact/contact/default_articles.php), has very limited possibilities on what fields it can show. While we can leave the default layout as it is, we should at least allow web designers that want to improve that view in a template override to be able to call for more fields, so we should make them available in the com_contact/models/contact.php. Specifically, I added introtext, images, and publish_up. Also it might be worth noting that right now default_articles.php uses a.created instead of a.publish_up to order articles, maybe using the latter would be more appropriate.

Summary of Changes

(changed in bold)

$query = $db->getQuery(true)
->select('a.id')
->select('a.title')
->select('a.introtext')
->select('a.images')
->select('a.publish_up')

->select('a.state')
->select('a.access')
->select('a.catid')
->select('a.created')
->select('a.language');

@henkrijneveld
Copy link

I have tested this item ✅ successfully on 5e96eaf

Tested OK, but seems to just address a specific need. Dont know how often it will be used.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/14671.

Copy link
Contributor

@Bakual Bakual left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't hurt to select more fields from a that table if they may be used in overrides.

@AndySDH
Copy link
Contributor Author

AndySDH commented Mar 31, 2017

@Bakual Thanks, I agree :) Here's just an example of what can be accomplished with those additional fields available: https://www.thesmackdownhotel.com/channel/wwe-2k
Not even using introtext here. With introtext, you could even replicate a blog layout exactly. Well, except for pagination... pagination would be another cool thing to be added to Author Articles, Wordpress does have it. But this is outside the scope of this PR :)

@ghost
Copy link

ghost commented May 24, 2017

@AndySDH where to find Settings for introtext, images and publish_up after applying PR?

@AndySDH
Copy link
Contributor Author

AndySDH commented May 24, 2017

@franz-wohlkoenig There are no settings, as the Contact Articles options are really really limited right now. We only have "Show User Articles (Show/Hide) and "# Articles to List" (Contact Articles options would definitely need some love overall, but I understand it's far from being a priority)

So right now the only way to customize the output of Contact Articles is not via options but by overriding the template file of com_contact/contact/default_articles.php

All this PR does is making more fields (introtext, images and publish_up) available to be used in said overrides.

@ghost
Copy link

ghost commented May 24, 2017

@AndySDH got it, thanks for Info. I thought its about Core-Options (which i would like).

@AndySDH
Copy link
Contributor Author

AndySDH commented May 24, 2017

@franz-wohlkoenig Ideally, it would be fantastic if Contact Articles could use the same options as Category Articles (with options for both Blog Layout / List Layout), including pagination. Currently it's a display of it's own and it's very limited. But I assume that would be a big project.

@ghost
Copy link

ghost commented May 24, 2017

Title, Introtext, Image, Createddate + Pagination > huge Step.

@AndySDH
Copy link
Contributor Author

AndySDH commented May 24, 2017

Yeah, so maybe you guys can consider it for the future. Perhaps to use the same "shared" Article settings as Categories.
But for now, this is meant to be a simple addition for those who simply want to use those fields in an override on their own.

@AndySDH
Copy link
Contributor Author

AndySDH commented Jul 26, 2017

Hello, what is the status of this small fix being added? Newer and newer Joomla updates keep coming out yet this keeps seeming to be left out, so I'm finding myself to always having to core-override it on each update.
Thanks :)

@AndySDH
Copy link
Contributor Author

AndySDH commented Nov 8, 2017

It might be worth noting that right now default_articles.php uses a.created instead of a.publish_up to order articles, maybe using the latter would be more appropriate.

I noticed that this was low-key fixed in 3.8.2, not sure if there was another PR for it.

I also noticed that ->select('a.publish_up') was added to the list of available fields, so we're almost there haha :) However ->select('a.introtext') and ->select('a.images') still weren't added. Any chance those get added too?

@infograf768
Copy link
Member

I have tested this item ✅ successfully on 8d93a4a


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/14671.

@ghost
Copy link

ghost commented Nov 9, 2017

@henkrijneveld can you please retest?

@AndySDH
Copy link
Contributor Author

AndySDH commented Nov 9, 2017

Hey guys, please note that now the components/com_contact/models/contact.php file is very different in 3.8.2 than what it was when this PR was first opened, so the whole content of the file in this PR would be conflicting with the current one.

But the only difference is adding these lines to the current one in the same position as before:
->select('a.introtext')
->select('a.images')

It works just fine, using it on my site (which is updated to 3.8.2)
https://www.thesmackdownhotel.com/channel/wwe-2k

@ghost
Copy link

ghost commented Nov 26, 2017

Status is set on "Needs Review".

@coolcat-creations
Copy link
Contributor

You could create an override for Modules: Articles - Category, include it in contacts and filter by the author too :)


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/14671.

@ghost ghost added the J3 Issue label Apr 5, 2019
@ghost ghost removed the J3 Issue label Apr 19, 2019
@Quy
Copy link
Contributor

Quy commented May 12, 2019

Let's decide whether to include the following:

->select('a.introtext')
->select('a.images')

@HLeithner
Copy link
Member

Please rebase for j4.0. thx.

@HLeithner HLeithner closed this May 13, 2019
AndySDH added a commit to AndySDH/joomla-cms that referenced this pull request May 14, 2019
The Joomla 4 re-do version of this: joomla#14671

This adds the ability to display images and introtext fields for articles in contact pages.

Despite not being used in the default core view, this is useful to make the introtext and images fields available at your disposal to use in overrides.
@AndySDH
Copy link
Contributor Author

AndySDH commented May 14, 2019

Created this: #24897

wilsonge pushed a commit that referenced this pull request Oct 19, 2019
…#24897)

The Joomla 4 re-do version of this: #14671

This adds the ability to display images and introtext fields for articles in contact pages.

Despite not being used in the default core view, this is useful to make the introtext and images fields available at your disposal to use in overrides.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants