magento2 – how to add dynamic rows to edit product page for specific type

I add dynamic rows to the product_form.xml file as follows. However, it appears on all product add pages. How do I just add to the specific type I want.

    <?xml version="1.0" encoding="UTF-8"?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <container name="ingredients_container">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">

                <item name="sortOrder" xsi:type="number">0</item>
                <item name="label" xsi:type="string">Ingredients</item>
            </item>
        </argument>
        <modal name="ingredients_modal">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="onCancel" xsi:type="string">actionCancel</item>
                    <item name="onDone" xsi:type="string">actionDone</item>
                    <item name="options" xsi:type="array">
                        <item name="buttons" xsi:type="array">
                            <item name="0" xsi:type="array">
                                <item name="text" xsi:type="string">Cancel</item>
                                <item name="class" xsi:type="string">action-secondary</item>
                                <item name="actions" xsi:type="array">
                                    <item name="0" xsi:type="string">actionCancel</item>
                                </item>
                            </item>
                            <item name="1" xsi:type="array">
                                <item name="text" xsi:type="string">Done</item>
                                <item name="class" xsi:type="string">action-primary</item>
                                <item name="actions" xsi:type="array">
                                    <item name="0" xsi:type="string">actionDone</item>
                                </item>
                            </item>
                        </item>
                    </item>
                </item>
            </argument>

            <dynamicRows name="dynamic_rows" >
                <settings>
                    <addButtonLabel translate="true">Add</addButtonLabel>
                    <addButton>true</addButton>
                    <deleteProperty>false</deleteProperty>
                    <additionalClasses>
                        <class name="admin__field-wide">true</class>
                    </additionalClasses>
                    <componentType>dynamicRows</componentType>
                    <recordTemplate>record</recordTemplate>
                </settings>
                <container name="record" >
                    <argument name="data" xsi:type="array">
                        <item name="config" xsi:type="array">
                            <item name="component" xsi:type="string" e>Magento_Ui/js/dynamic-rows/record</item>
                            <item name="isTemplate" xsi:type="boolean">true</item>
                            <item name="is_collection" xsi:type="boolean">true</item>
                            <item name="componentType" xsi:type="string">container</item>
                        </item>
                    </argument>
                    <field name="ingredient_list" formElement="select">
                        <argument name="data" xsi:type="array">
                            <item name="config" xsi:type="array">
                                <item name="source" xsi:type="string">product</item>
                            </item>
                        </argument>
                        <settings>

                            <dataType>text</dataType>
                            <label>Ingredients</label>
                        </settings>
                        <formElements>
                            <select>
                                <settings>
                                    <options class="VendorModuleModelConfigProductIngredientOptions"/>
                                    <caption translate="true">-- Please Select --</caption>
                                </settings>
                            </select>
                        </formElements>
                    </field>
                    <field name="label" formElement="input">
                        <argument name="data" xsi:type="array">
                            <item name="config" xsi:type="array">
                                <item name="fit" xsi:type="boolean">false</item>
                            </item>
                        </argument>
                        <settings>
                            <validation>
                                <rule name="required-entry" xsi:type="boolean">true</rule>
                            </validation>
                            <dataType>text</dataType>
                            <label>Label</label>
                        </settings>
                    </field>
                    <field name="measure" formElement="input">
                        <argument name="data" xsi:type="array">
                            <item name="config" xsi:type="array">
                                <item name="fit" xsi:type="boolean">false</item>
                            </item>
                        </argument>
                        <settings>
                            <dataType>text</dataType>
                            <label>Measure</label>
                        </settings>
                    </field>
                    <field name="quantity" formElement="input">
                        <argument name="data" xsi:type="array">
                            <item name="config" xsi:type="array">
                                <item name="fit" xsi:type="boolean">false</item>
                            </item>
                        </argument>
                        <settings>
                            <validation>
                                <rule name="required-entry" xsi:type="boolean">true</rule>
                            </validation>
                            <dataType>text</dataType>
                            <label>Quantity</label>
                        </settings>
                    </field>
                    <actionDelete template="Magento_Backend/dynamic-rows/cells/action-delete">
                        <settings>
                            <componentType>actionDelete</componentType>
                            <dataType>text</dataType>
                            <label>Actions</label>
                            <additionalClasses>
                                <class name="data-grid-actions-cell">false</class>
                            </additionalClasses>
                        </settings>
                    </actionDelete>
                </container>
            </dynamicRows>
        </modal>

        <button name="modal_button">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="title" xsi:type="string">Select Ingredients</item>
                    <item name="actions" xsi:type="array">
                        <item name="0" xsi:type="array">
                            <item name="targetName" xsi:type="string">${ $.parentName}.ingredients_modal</item>
                            <item name="actionName" xsi:type="string">openModal</item>
                        </item>
                    </item>
                </item>
            </argument>
        </button>
    </container>
</form>

unity – How can I add orbit effect to the camera?

On my player I have the component Animator , Rigidbody , Capsule Collider , Third Person User Control script , Third Person Character script.

Player Settings

On the Main Camera there are two scripts but only one is activated for now : Camera Follow and Mouse Orbit With Zoom :

Main Camera Settings

The Camera Follow script is working fine. The problem is when I’m activating the Mouse Orbit With Zoom script if I move the player with the keys WASD and also rotate orbit the camera with the mouse the player lose focus. He does change his direction according to the mouse rotation but also lost focus :

Player lost focus when rotation camera

And also for some reason I can make the camera rotation to be diagonal:

diagonal

The reason Main Camera is not child of the player is that it’s making the camera stuttering and rotating very fast on place. That is why I added the Camera Follow script.

The Camera Follow script :

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CameraFollow : MonoBehaviour
{
    public Transform player;
    public Vector3 offset;

    // Update is called once per frame
    void Update()
    {
        transform.position = player.position + offset;
    }
}

The orbit script :

using UnityEngine;
using System.Collections;

(AddComponentMenu("Camera-Control/Mouse Orbit with zoom"))
public class MouseCameraOrbit : MonoBehaviour
{
    public Transform target;
    public float speed;

    private void Update()
    {
        if (Input.GetMouseButton(0))
        {
            transform.RotateAround(target.position,
                                            transform.up,
                                            -Input.GetAxis("Mouse X") * speed);

            transform.RotateAround(target.transform.position,
                                            transform.right,
                                            -Input.GetAxis("Mouse Y") * speed);
        }
    }
}

My game is adventure game type and the main goal is to make player movement to be with the keys and also to be able to look around like orbiting with the mouse because only following the player will not show where to go , that is why I’m trying to add orbiting, but the orbiting part is just not working good.

php – what is the best practice to add new field to an api route

I’m modifying the WP REST API for mobile app usage, and I went through at the first registering new fields route using the rest_api_init action or hook using the func register_rest_field, but I found there’s a lot of fields I don’t need it or wanted so I get rid of it by using the filter rest_prepare_post

What I found out is I can actually add new fields in my filter by modifying the data array and no needs for the rest_api_init or register_rest_field at all.

So what I am asking is what is the best approach for doing this? is it good to add and remove fields in one function instead of two? I’m now using both register_route_field for the new fields and unset all the unnecessary fields by rest_prepare_post

Socks5 Proxy Service Cheap Socks5


SOCKS Proxy List by Tisocks.net
If you Need Socks5 , Please visit service and add fund via PM , BTC WMZ . Thanks all!!
Add fund : https://tisocks.net/addfund
Check socks5 Online here : https://checksocks5.com
LIVE | 66.42.224.229:41679 | 2.939 | SOCKS5 | Ohio | 45226 | fuse-dedicated-66-42-224-229.fuse.net | United States | Checked at https://tisocks.net
LIVE | 78.187.170.16:1080 | 0.702 | SOCKS5 | Unknow | Unknow | 78.187.170.16.dynamic.ttnet.com.tr | Unknow | Checked at https://tisocks.net
LIVE | 174.76.48.233:4145 | 2.976 | SOCKS5 | New York | 10001 | Cox Communications | United States | Checked at https://tisocks.net
LIVE | 51.81.31.65:61544 | 0.429 | SOCKS5 | Indiana | 47274 | Jackson Co REMC | United States | Checked at https://tisocks.net
LIVE | 138.197.2.106:60261 | 0.331 | SOCKS5 | Unknow | Unknow | | Unknow | Checked at https://tisocks.net
LIVE | 185.117.244.136:9050 | 0.89 | SOCKS5 | Unknow | Unknow | Markus Koch | Unknow | Checked at https://tisocks.net
LIVE | 174.76.48.225:4145 | 2.694 | SOCKS5 | New York | 10001 | Cox Communications | United States | Checked at https://tisocks.net
LIVE | 138.197.2.106:64465 | 0.357 | SOCKS5 | Unknow | Unknow | | Unknow | Checked at https://tisocks.net
LIVE | 51.81.31.66:53327 | 0.725 | SOCKS5 | Florida | 32219 | c-73-224-131-157.hsd1.fl.comcast.net | United States | Checked at https://tisocks.net
LIVE | 178.62.197.23:44941 | 0.191 | SOCKS5 | Unknow | Unknow | | Unknow | Checked at https://tisocks.net
LIVE | 51.81.31.62:45777 | 0.535 | SOCKS5 | Texas | 76063 | 068-184-183-134.res.spectrum.com | United States | Checked at https://tisocks.net
LIVE | 47.93.84.168:1081 | 4.488 | SOCKS5 | Unknow | Unknow | Hangzhou Alibaba Advertising Co.,Ltd. | China | Checked at https://tisocks.net
LIVE | 51.81.31.66:49480 | 0.468 | SOCKS5 | Colorado | 80226 | c-67-190-32-120.hsd1.co.comcast.net | United States | Checked at https://tisocks.net
LIVE | 95.179.196.174:31204 | 0.213 | SOCKS5 | England | E1 | 95.179.196.174.vultr.com | United Kingdom | Checked at https://tisocks.net
LIVE | 51.81.31.66:53628 | 0.535 | SOCKS5 | Nevada | 89117 | 71-222-98-96.lsv2.qwest.net | United States | Checked at https://tisocks.net


tisocks
Reviewed by tisocks on
.
[Tisocks.net] – Socks5 Proxy Service Cheap Socks5
SOCKS Proxy List by Tisocks.net
If you Need Socks5 , Please visit service and add fund via PM , BTC WMZ . Thanks all!!
Add fund : https://tisocks.net/addfund
Check socks5 Online here : https://checksocks5.com
LIVE | 66.42.224.229:41679 | 2.939 | SOCKS5 | Ohio | 45226 | fuse-dedicated-66-42-224-229.fuse.net | United States | Checked at https://tisocks.net
LIVE | 78.187.170.16:1080 | 0.702 | SOCKS5 | Unknow | Unknow | 78.187.170.16.dynamic.ttnet.com.tr | Unknow | Checked at

Rating: 5



.

javascript – Trying to add a custom .js file for the User module

I register my js file in user.libraries.yml file my custom js file is user.custom.js.


drupal.user:
  version: VERSION
    js:
      user.js: {}
      user.theme.js: {}
      user.custom.js: {}

I added this line to user module’s RegisterForm.php file.

$element('#attached')('library')() = 'user/drupal.user';

I am getting this error.

User warning: The following theme is missing from the file system: user.custom in drupal_get_filename()

Trying to add a custom .js file for user module in Drupal 8

1.I register my js file in user.libraries.yml file my custom js file is user.custom.js


   drupal.user:
      version: VERSION
      js:
        user.js: {}
        user.theme.js: {}
        user.custom.js: {}

2.I added this line to user module's RegisterForm.php file
    $element('#attached')('library')() = 'user/drupal.user';

3.Getting error like-
User warning: The following theme is missing from the file system: user.custom in drupal_get_filename() (line 295...