Feature Request - automatic alias building #246

Closed
opened 2018-03-19 14:48:15 +00:00 by cpaschen · 6 comments
cpaschen commented 2018-03-19 14:48:15 +00:00 (Migrated from github.com)

One thing that I find I'm often doing is manually modifying the building of the alias field.
This is usually due to the fact that I need to create a 'compound' (or 'concat') alias, based on a couple/few fields (the most common is that of first/last name for people records).

I'm still not quite up to actually digging under the hood of JCB and actually suggesting a change in code myself, but wondering if this is something that others might be interested in as well.

If I were to have time to create this code, I'm not quite sure where it would go. Not sure if it would go into the Fields system or within the Admin view or exactly where?

What do others think about this?

One thing that I find I'm often doing is manually modifying the building of the alias field. This is usually due to the fact that I need to create a 'compound' (or 'concat') alias, based on a couple/few fields (the most common is that of first/last name for people records). I'm still not quite up to actually digging under the hood of JCB and actually suggesting a change in code myself, but wondering if this is something that others might be interested in as well. If I were to have time to create this code, I'm not quite sure where it would go. Not sure if it would go into the Fields system or within the Admin view or exactly where? What do others think about this?
mwweb commented 2018-03-19 17:03:34 +00:00 (Migrated from github.com)

I, too, had to do this on a component. I added custom code, but it would have been nice to have the ability to have the alias field created in jcb with field(s) that i set in the field.

I, too, had to do this on a component. I added custom code, but it would have been nice to have the ability to have the alias field created in jcb with field(s) that i set in the field.

There is already some automation with the alias, but to effect the build from within JCB does not exist at this point.

I can give you insight on where it is being build, also where in the actual component the code is found that deals with alias.

So you will see two functions at work:

  • $this->generateNewTitle() native function of AdminModel.php#L895
  • $this->_generateNewTitle() Build in JCB

Okay in JCB:

This functions are all found in the model of the view, so in Sermon Distributor for example you can find it in sermon.php#L1081

So those are the areas that would need to be adapted to automate this. One idea would be to in the admin view be able to select multiple fields (that is part of that admin view) to dynamic build alias if left empty.

This will not be that hard to achieve 👍

There is already some automation with the alias, but to effect the build from within JCB does not exist at this point. I can give you insight on where it is being build, also where in the actual component the code is found that deals with alias. So you will see two functions at work: - `$this->generateNewTitle()` native function of [AdminModel.php#L895](https://github.com/joomla/joomla-cms/blob/staging/libraries/src/MVC/Model/AdminModel.php#L895) - `$this->_generateNewTitle()` Build in JCB Okay in JCB: - At [e_Interpretation.php#L5502](https://github.com/vdm-io/Joomla-Component-Builder/blob/staging/admin/helpers/compiler/e_Interpretation.php#L5502) we build the alias fix, when coping a item. - At [e_Interpretation.php#L5602](https://github.com/vdm-io/Joomla-Component-Builder/blob/staging/admin/helpers/compiler/e_Interpretation.php#L5602) we build the function to dynamic update the title and alias. (`$this->_generateNewTitle()`) This functions are all found in the model of the view, so in Sermon Distributor for example you can find it in [sermon.php#L1081](https://github.com/SermonDistributor/Joomla-3-Component/blob/master/admin/models/sermon.php#L1081) So those are the areas that would need to be adapted to automate this. One idea would be to in the admin view be able to select multiple fields (that is part of that admin view) to dynamic build alias if left empty. This will not be that hard to achieve :+1:

Please, test the feature. You will see in the admin view-tab->Fields & Conditions there are new buttons, that will show if the admin view has an alias set.

With these new fields:
Alias Builder Type
Alias Builder

You can select any of the other field in the view, to be used to build that alias. (ONLY TEXT FIELDS)

Please give me your feedback!

Please, test the feature. You will see in the **admin view**-tab->**Fields & Conditions** there are new buttons, that will show if the admin view has an alias set. With these new fields: `Alias Builder Type` `Alias Builder` You can select any of the other field in the view, to be used to build that alias. (ONLY TEXT FIELDS) Please give me your feedback!
ro-ot commented 2018-03-29 21:21:07 +00:00 (Migrated from github.com)

I have also tested this, and it seems all good 😄

I have also tested this, and it seems all good :smile:
cpaschen commented 2018-03-30 14:00:04 +00:00 (Migrated from github.com)

This seems to work as designed; however, for my specific needs (in a number of different cases) I actually need to build even more complex alias that can't rely on just text fields like this. So, I guess for those cases I'll just stick with the overrides; however, this does solve about 75% of the instances that I have (esp. when I just have the name field with something other than 'name' for the field name).
Thanks!

This seems to work as designed; however, for my specific needs (in a number of different cases) I actually need to build even more complex alias that can't rely on just text fields like this. So, I guess for those cases I'll just stick with the overrides; however, this does solve about 75% of the instances that I have (esp. when I just have the name field with something other than 'name' for the field name). Thanks!

One step at a time.... we can grow this. It is a start.

One step at a time.... we can grow this. It is a start.
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: joomla/Component-Builder#246
No description provided.