Skip to Content Skip to Menu

CB - ImageField: forgotten parameter "fieldLayoutContentPlugins"

  • dg1
  • dg1
  • OFFLINE
  • Posts: 27
  • Thanks: 1
  • Karma: 1
9 months 2 weeks ago #337063 by dg1
Hi,

The above-mentioned field contains the "fieldLayoutContentPlugins" parameter, the handling of which, I guess, got lost somewhere some time ago. ;-)
Since I have been using the mechanism of supplementing/modifying the appearance of the user's image thumbnail via a dedicated CMS Content plugin for several years, each CB update forces me to "repair" this deficiency again.

My update is to complete the code in the file /home/.../public_html/components/com_comprofiler/plugin/user/plug_cbcore/library/Field/ImageField.php
Class ImageField function _avatarHtml() po linii 789
Code:
        $return                    .=    $closeTag;                  // DG - 2021-11-08         if ( $field->params->get( 'fieldLayoutContentPlugins', 0 ) ) {             $return    =    Application::Cms()->prepareHtmlContentPlugins( $return, 'field.avatar', ( $user !== null ? $user->id : 0 ) );         }         return $return;


The second issue related to the user thumbnail is the possibility of supplementing it with a tooltip with the content of the [$title] variable in the case of a thumbnail with an initial.

I hope that with this entry I will not completely remove the "fieldLayoutContentPlugins" parameter. 😱
Thank you and best regards,

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48536
  • Thanks: 8290
  • Karma: 1445
9 months 2 weeks ago - 9 months 2 weeks ago #337065 by krileon
Nope, it works perfectly fine. It applies exclusively to the layout parameters above it. It does not apply to the field value directly. You're welcome to make your change though, but that will not be applied to the core, sorry. You can completely replace the HTML entirely using the layout parameters. Example as follows.

Code:
<img src="[FIELD_NAME]" alt="My Custom Layout" class="myCustomCSSClass" />


[FIELD_NAME] substitutions should give the live path for image fields, but that may only apply to userdata substitutions. You can however build the path out manually as needed though.

It's also possible to use onAftergetFieldRow to modify the entire HTML of a field using CB Auto Actions if you need to extend the field with custom rendering. This gives the full HTML structure that the field will output so you'd need to traverse the DOM structure it outputs or be careful with your regexp replacements.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
Last edit: 9 months 2 weeks ago by krileon.
The following user(s) said Thank You: dg1

Please Log in or Create an account to join the conversation.

  • dg1
  • dg1
  • OFFLINE
  • Posts: 27
  • Thanks: 1
  • Karma: 1
9 months 1 week ago #337144 by dg1
Ok, now everything is clear. I know where I made a mistake in my thinking.
I need to decide whether to use the current approach using the "fieldLayoutContentPlugins" parameter, with the difference that I will use the layout parameters, context 'field.layout'
and build the full structure of the "avatar" field in the Content Plugin or use the "Auto Actions" add-on you mentioned and use "onAftergetFieldRow".
In the latter case, there will be no trouble traversing the DOM of the HTML structure generated by the field because I am currently using this exact strategy. :-)

Using "Auto Actions" seems more elegant...
Thanks for the explanation and best regards,

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48536
  • Thanks: 8290
  • Karma: 1445
9 months 1 week ago #337149 by krileon
You also have the option of using something like CB Code Field. Basically move the storage and display to 2 separate fields. The code field lets you run and display whatever PHP you like. So you could use that to build out the field to display however you like. Once done and displaying how you wanted move the code field to a tab that's in a not shown on profile position. Next override the layout of your image field with a substitution of that code field. This would make it so the display of your image field will be that of your code field.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum