Motivation

I want to disable a widget based on the value of another field in the entity being edited. I wan to do it with a HOOK_form_editablefields_form_alter() but I have small context about what I'm altering since the field_name and the entity are protected properties of the form object.

Proposed resolution

Add getEntity and getFieldName getters to the Form class.

Remaining tasks

Code

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

rodrigoaguilera created an issue. See original summary.

rodrigoaguilera’s picture

Status: Active » Needs review
gilmord’s picture

Status: Needs review » Needs work

Hi @rodrigoaguilera, good idea

A couple of suggestions:
- implement getter for protected $form_mode
- move getters above buildForm method, so we have all getters in one place

Thanks!

rodrigoaguilera’s picture

Status: Needs work » Needs review

Sure

gilmord’s picture

Status: Needs review » Fixed

Thanks, looks good, works good, merged

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.