How to enable "Contribute Global" by script on Editor?

I created a script to enable/disable lighting options in children objects of a specific GameObject on Editor. I’m trying to access “Contribute Global” option
153687-global-off.jpg

to turn ON:
153688-global-on.jpg

But i dont know how.
Which methods i nee to use?

My script:

using UnityEngine;
using UnityEditor;
using Object = UnityEngine.Object;

public class LightingToggle : EditorWindow
{
    public Object source;
    [MenuItem("Window/LightingToggle"), MenuItem("Tools/LightingToggle")]

    public static void Enable(){
            LightingToggle window = (LightingToggle)GetWindow(typeof(LightingToggle));
            window.titleContent = new GUIContent("LightingToggle");
    }

    private void TurnOffLight() {
        GameObject go = GameObject.Find(source.name);
        foreach (MeshRenderer filter in go.gameObject.GetComponentsInChildren<MeshRenderer>()){
            filter.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
            filter.receiveShadows = false;
        }
    }

    private void TurnOnLight(){
        GameObject go = GameObject.Find(source.name);
        foreach (MeshRenderer filter in go.gameObject.GetComponentsInChildren<MeshRenderer>()){
            filter.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On;
            filter.receiveShadows = true;
        }
    }

    void OnGUI(){
        EditorGUILayout.Space();
        if (GUILayout.Button("Turn Lighting Options Off")){
            TurnOffLight();
        }
        EditorGUILayout.Space();
        if (GUILayout.Button("Turn Lighting Options On")){
            TurnOnLight();
        }
        EditorGUILayout.Space();

    source = EditorGUILayout.ObjectField(source, typeof(Object), true);
    }
}

It can be manipulated by GameObjectUtility.GetStaticEditorFlags() & GameObjectUtility.SetStaticEditorFlags()
https://docs.unity3d.com/ScriptReference/GameObjectUtility.html

So, the flag belongs to GameObject but rendered in MeshRenderer’s inspector