Zend certified PHP/Magento developer

Hide (display:none) specific element from adminhtml Product page

On the adminhtml Product page, there exists a fieldset of Configurable Options. Certain Configurable Options I wish to hide from the content manager of the adminhtml screen as they are managed separately.

I can remove these options from being output to the page by overriding the afterModifyData() method of MagentoCatalogUiDataProviderProductFormModifierCustomOptions. However, in doing so these options are then removed from the Product when the content manager saves the Product. Therefore, I find it preferable to set the <tr> for these Customizable Options as display:none. This has the same effect as hiding the Customizable Option from the user, but does not remove the Customizable Option when the Product is saved.

Assuming that I can determine in PHP that I need to hide (display:none) the Customizable Options with the IDs 2, 4, 6, and 8, how might I go about it?

I’m hoping that there might be some method of injecting Javascript into the page from a PHP observer or method override. I’ve found reference in forum posts to after_element_html but I’ve been unsuccessful at figuring out where to inject it. I’ve tried injecting a Javascript alert box to no avail.

Furthermore, even if I can get arbitrary Javascript into the page, **How would I target the appropriate <tr> element. From examining the HTML of the element, the Customizable Option ID is not actually found in that part of the DOM! The only real unique identifier that seems to exist in that <tr> element is the Customizable Option’s title, but it is in the innerHtml of a <span> element and thus not targetable via CSS selector.

Could I perhaps, in PHP, add a CSS class to the <tr> element of each targeted Customizable Option? If so then I could load a stylesheet that hides elements of that class. That’s just one idea, are there perhaps other ways to hide specific Customizable Options by ID or Title?

Illustration of intent

To illustrate, we have these three Customizable Options:
Three Customizable Options, two of which need to be hidden.

I want to hide (via display:none) the two circled options. In PHP know that they have the IDs [2,4] and I know that they have the Titles ["John Lennon","George Harrison"].