Closed (fixed)
Project:
Simplify
Version:
2.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Reporter:
Created:
2 Jul 2025 at 11:41 UTC
Updated:
3 Nov 2025 at 10:59 UTC
Jump to comment: Most recent
Using the Simplify module with another custom module that use hook form alter trigger a crash from Simplify
TypeError : class_implements(): Argument #1 ($object_or_class) must be of type object|string, null given dans class_implements() (ligne 369 de *\modules\contrib\simplify\simplify.module).
Adding a null check for $entity
function simplify_form_alter(&$form, FormStateInterface $form_state, $form_id) {
if (!method_exists($form_state->getFormObject(), 'getEntity')) {
return;
}
$entity = $form_state->getFormObject()->getEntity();
if(!is_null($entity)) {
if (in_array('Drupal\eck\EckEntityInterface', class_implements($entity))) {
// Get array of fields to hide.
$fields = _simplify_get_config_value('simplify_eck_global');
// Hide fields.
simplify_hide_fields($fields, $form);
}
}
}
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
Comment #2
damiendo commentedComment #3
avpadernoComment #4
dhruv.mittal commentedComment #5
dhruv.mittal commentedI've checked .module file where simplify_form_alter hook present but it's empty.
Thank you
Comment #6
karavkars commentedComment #7
dhruv.mittal commentedGot it, providing MR for the same soon !
Comment #9
dhruv.mittal commentedComment #10
karavkars commentedReviewing this.
Comment #11
karavkars commentedHello @dhruv,
Reviewed your MR. applied patch on the module looks good.
Found coding standards issues, committed the same on this branch.
@Someone please review the same,
Regards,
Comment #12
kadamsubodh0619 commentedComment #13
kadamsubodh0619 commentedHello @dhruv, @karavkars
I reviewed MR raised by @dhruv and PHPCS fixes done by @karavkars.
Its working fine for me post applying patch from MR.
Moving this issue to RTBC.
Thank you,
Subodh Kadam
Comment #15
astonvictor commentedthanks for the report.
merged to the dev branch