How does Joomla create the Rules value in assets table? - joomla

I would like to know how does Joomla create the values in the Rule field in the #__assets table.
I believe that the files where they are created might be:
libraries\joomla\database\table\content.php
libraries\joomla\database\table.php
I have tried to find the code which does this but I either don't find it or what I do find just don't understand it. I need to know how Joomla creates these values in this field to be able to make my own process.

Every component controls its rules with an access.xml file. You will find these in the administrator/components/com_whatever folder.
Where specific rules are managed depends on the type of asset.
Component level rules are managed in com_config with the component mvc, meaning that when a user clicks the options button in the component they set the rules for the component.
Item level rules (such as for categories and articles) are managed in the form for those items via a field with type="rules."
Global rules are managed by com_config with the application mvc and the UI is in global configuration.
JTable manages storing this in the assets table.

Related

Add or Edit relation fields in Content Manager of Strapi

I am building a simple recipe website by Strapi. Now I want to make one Recipe has so many Ingredient. Therefore, there are two collections, They are in Many way relationship (Since I don't need to point back or link back to Recipe)
However, in Content Manager, I have to create some Ingredient items before creating one Recipe.
Is it possible to create or edit Ingredient while create Recipe in the same page?
Yes, this is possible using components in strapi. So basically, you'll need to create a Recipe collection and Ingredient component, and link to the component to Recipe collection as a repeatable component. So this way when you create a Recipe entry, you'll be able to add/edit the ingredients entries on the fly.
Have a look at this link to learn how to create a component.
Once you've created the component, follow the steps below to link it to the Recipe collection:
Edit the Recipe collection and add an existing component.
Set the component as a Repeating component.
Your model configuration should look similar to this.
Save the changes to the Recipe collection and then try creating an entry. You'll be presented with the following user interface that lets you edit/add ingredients on the fly.
Publish the entries and hit the find API will the populate key in URL like so:
http://localhost:1337/api/receipes?populate=ingredients

How does beforeSaveAddressInformation plugin

I was looking at this post: Magento 2 Add a custom input field on chackout forrm and save it
I have tried the same way but I am not sure how this part came
$customField = $shippingAddressExtensionAttributes->getFiscalCode();
$shippingAddress->setFiscalCode($customField);
Where is this getFiscalCode?
It's a Custom AttributeCode.
the getFiscalCode() method is an accessor method that is used to identity fields such as the one that is created with the extension attribute fiscal_code mentioned in the example.
It is not just extension attributes, but all collection models in magento use the following camel casing structure where for example the column entity_id in database table, can be accessed via either $modelCollection->getEntityId() or $modelCollection->setEntityId($valueOfEntityId)
This is a good read to understand the idea Magento 2: CRUD Models for Database Access

Adding multiple entities to one main form

I am in the process of modifying forms to account for V9 of Dynamics which is being rolled out currently.
Our environment is using Dialogs but these are being deprecated with V9 which means we have to prepare the forms to be used instead of these Dialogs.
Due to how fragmented our solution is the data is all over the place in different entities and can all be written too at different times.
Is it possible to have multiple entities/records on the same form which are all editable? This way I can run rules to hide and show as people edit specific fields.
From what I can identify, there is no "true" way to achieve this. However, if there are entities which are linked via a relationship within the solution, it is possible to add the "Party List" type field to the form and this will act as the link between the two entities. When you go to search for an existing record within the related entity, there is a new button which allows you too create a new record of that entity which directly associated with the form you were working on initially.
We do have editable subgrids. Add the subgrids of related entities & allow users to edit the related records in main record form at one shot.

How VirtueMart sends the data when you save the custom fields in a product

first of all, sorry for my english, but I'll try to explain myself best I can.
My question is little tricky, because I made some important changes in the core code of VirtueMart.
For some reasons, I added an attribute to the Custom Fields, like Price, called Availability.
TIP: The admin site is in Spanish. Disponibilidad = Availability
So, now, when I try to change any value of any created Custom Field, I can't save it. I mean, I can change the value, but when I apply them, It doesn't be saved.
The only field that I can change, is the field I created, the Availability (ironically).
So, my principal question is, how does VirtueMart to pick up the data from the table and sends them to the database?
I work with
Joomla v.2.5.11
VirtueMart 2
Thanks
The workflow is like follows,
When you save the products details on the backend , It calls a function store() on the product.php model. under administrator/components/com_virtuemart/models/. Inside this function an area like follows.
if(!class_exists('VirtueMartModelCustom')) require(JPATH_VM_ADMINISTRATOR.DS.'models'.DS.'custom.php');
VirtueMartModelCustom::saveModelCustomfields('product',$data,$product_data->virtuemart_product_id);
It loading the custom model file from the same path and do the task inside saveModelCustomfields()
Hope it helps..

How to find out the Joomla components base table name

I want to know in which table a joomla component stores its data and I want to achieve this programmatically. (I already know through phpmyadmin the relevant tables a component stores data in.) For eg. if I know that the base component is com_content then how can the Joomla 3.1 platform a.p.i tell me that it stores its data in #__content table.
The content types table provides information on this if your component has stored rows there. Using this you can programmatically get both the db table as well as the JTable data. In 3.2. there are a couple of places where this is used nicely such as in the ordering field and in versioning.

Resources