← Back to Back To Front Support
Hi, does is support rendering relations? I get the following error:
An exception has been thrown during the rendering of a template ("Method [relationRender] does not exist on [Acme\PluginName\Controllers\ControllerName].").
Last updated
Hi! Backend.Behaviors.RelationController in the base component and config_relation.yaml file not used (relation work at the level of embedded widgets full supports!). If there is a real need to use it, then I can work out the question of its implementation in the plugin in the next day or two (are you ready to wait for the result?). Yes, I lowered this moment from attention, because there was no need for this and by first design it was not intended to completely duplicate all the functionality of the backend when working with lists. If it is urgent and you want to do it quickly and yourself, then see lines 241-248 BackToFront component and add by analogy with List and Form Behaviors (add Backend.Behaviors.RelationController and config_relation.yaml). This also applies to Import / Export Behaviors. I think that after adding everything should work as it should. It is possible that there may be any problems, so it is better to wait for my implementation and update of the plugin. Thanks for the feedback!
Last updated
I have managed to implement some functionality for testing purposes. I will update the plugin with your code.
Would you consider extending the plugin with the functionality shown in the image below? https://pasteboard.co/IkW2fQ4.png
I wanted to have a custom form field name and wanted to hide it in form. I did $fields->{$this->property('hideUserFormField')}->hidden = true; Then i manually added the value for user field in request() in methods onSave and onUpdate.
I did not understand a few moments, but I caught the main idea. Everything is a little wrong (I will explain the demo):
- All distributor records are filtered by ID, i.e. distributor = user_id (after filtering, remain records only clients belonging to this distributor). The distributor is logged in to the personal account, not the client and manipulates the records of its clients.
- If you need to visually hide field, then you can simply add in fields.yaml for model field this:
cssClass: hidden
and this no visibled on front and backend and without unnecessary manipulations, POST-request sends with this field value, + you can try these properties: readOnly: true, disabled: true, in some cases they also apply.
The meaning of the demo is to show the possibility of creating a personal distributor account (user_id = 1, therefore, in the first table, the 2nd distributor with user_id = 2 is not visible and this is done using the SQL-prefilter). The same filtering result is obtained using a custom plug-in after logging in (set Session component from Rainlab.User on page, checked "User Filtering" and set table record for user identificator "User field name", in this case Arbitrary SQL-prefilter not used). I agree that in the second table (userclientsmoney) the information on the distributor's identifier is redundant (apparently you wanted to get rid of this), but this is just a demo
Last updated
Regarding the use of the add-on Behaviors in top level in component (on controller analogy): Backend.Behaviors.RelationController, Backend.Behaviors.ImportExportController, Backend.Behaviors.ReorderController, then I am already working on them. Unfortunately, not everything is good in terms of implementation - there are several obstacles, I will try to solve them.
Thanks for the update. I think it is a great plugin and I see it is still a work in progress.
I have deleted the post you commented on. It was late when I was writing it and I knew it would be confusing. I will try to explain more accurately later. But first...
I have included the 'Session' component in the page that uses your component and I have restricted it to 'Users' only. If I access the page via URL when the FE user is not logged in I get the following error.
https://pasteboard.co/Il2RKoZ.png
The problem is in the page life cycle (https://octobercms.com/docs/plugin/components#page-cycle-handlers). Changing the 'init' method to 'onRun' method in BackToFront.php and 'onStart' to 'onEnd' function in code section of the page solves the problem.
Last updated
mitch said:
Thanks for the update. I think it is a great plugin and I see it is still a work in progress.
I have deleted the post you commented on. It was late when I was writing it and I knew it would be confusing. I will try to explain more accurately later. But first...
I have included the 'Session' component in the page that uses your component and I have restricted it to 'Users' only. If I access the page via URL when the FE user is not logged in I get the following error.
https://pasteboard.co/Il2RKoZ.png
The problem is in the page life cycle (https://octobercms.com/docs/plugin/components#page-cycle-handlers). Changing the 'init' method to 'onRun' method in BackToFront.php and 'onStart' to 'onEnd' function in code section of the page solves the problem.
Yes, using a custom plugin - better solution. In the component, init() used not by chance - the only way I was able to initialize the widget assets into the assets array and connect them on onStart () for proper operation. In my environments (in a test environment, in production on Windows and Debian, an unauthorized user does not lead to an error, since the component is used in the personal account, which initially implies the lack of access for unauthorized users on account page).
In work with the Relation, Reorder, Import / Export, there has been progress - all the basic functionality has been implemented. There are still problems with Import / Export and Relations (in the latter there is a problem with Ajax-handlers when searching and choosing from the dropdown). All fixes are available in the demo version. I think so far it is not necessary to issue a new release until these problems are fixed. I hope to do it in the next day or two.
Last updated
I have included the 'Session' component in the page that uses your component and I have restricted it to 'Users' only. If I access the page via URL when the FE user is not logged in I get the following error.
To remove this error simply add a check for the existence of an object. Please change this lines in component:
(line 203 in original code)
- if (Settings::get('rainlabuser') && $this->property('allowRainlabUser')) $this->user = \RainLab\User\Facades\Auth::getUser()->id;
(line 250 in original code)
- if (Settings::get('rainlabuser') && $this->property('allowRainlabUser'))
on
if (Settings::get('rainlabuser') && $this->property('allowRainlabUser')) { $user = \RainLab\User\Facades\Auth::getUser(); if ($user) $this->user = $user->id; }
if (Settings::get('rainlabuser') && $this->property('allowRainlabUser') && !empty($this->user))
Last updated
Hi! Plugin updated to v1.0.2 - adding work with Backend Behaviors: Relation, Reorder, Import/Export Controllers in EXPERIMENTAL mode! This means that this functionality is either unstable or does not work in full. Several fundamental points related to the aliases of these controllers remained insoluble, since it was not possible to change them from my code (it depends on them that the AJAX framework works correctly with my components). Summing up: most of the functions work, but it takes a lot of time for improvements.Unfortunately, current projects do not allow this to be done in the near future.
Last updated
1-9 of 9