How to use semantics?
Submitted by graceman9 on Tue, 05/24/2016 - 19:16
Forums:
I'm trying to hide some fields from Interactive Video content type. Is it a right way to use semantics to achieve that?
I wrote a code and it works, until I'm on the edit node page:
<?php function MYMODULE_h5p_semantics_alter(&$semantics, $machine_name, $major_version, $minor_version) { if ($machine_name == 'H5P.InteractiveVideo' && $major_version == 1 && $minor_version == 9) { unset($semantics[0]->fields[0]->fields[1]); unset($semantics[0]->fields[0]->fields[2]); unset($semantics[0]->fields[0]->fields[3]); unset($semantics[0]->fields[0]->fields[4]); $semantics[0]->fields[0]->fields = array_values($semantics[0]->fields[0]->fields); unset($semantics[1]); unset($semantics[2]); $semantics = array_values($semantics); unset($semantics[0]->fields[2]->fields[1]); $semantics[0]->fields[2]->fields = array_values($semantics[0]->fields[2]->fields); } } ?>But when I press "Save" node button I'm getting a multiple warnings:
Notice: Trying to get property of non-object in H5PContentValidator->_validateFilelike() (line 3028 of /var/www/drupal7/sites/all/modules/h5p/library/h5p.classes.php).
Notice: Trying to get property of non-object in H5PContentValidator->_validateFilelike() (line 3033 of /var/www/drupal7/sites/all/modules/h5p/library/h5p.classes.php).
Warning: Attempt to assign property of non-object in H5PContentValidator->_validateFilelike() (line 3033 of /var/www/drupal7/sites/all/modules/h5p/library/h5p.classes.php).
Warning: Invalid argument supplied for foreach() in H5PContentValidator->filterParams() (line 3231 of /var/www/drupal7/sites/all/modules/h5p/library/h5p.classes.php).
Notice: Undefined property: stdClass::$path in H5PContentValidator->_validateFilelike() (line 3028 of /var/www/drupal7/sites/all/modules/h5p/library/h5p.classes.php).
Notice: Undefined property: stdClass::$path in H5PContentValidator->_validateFilelike() (line 3033 of /var/www/drupal7/sites/all/modules/h5p/library/h5p.classes.php).
Notice: Trying to get property of non-object in H5PContentValidator->_validateFilelike() (line 3028 of /var/www/drupal7/sites/all/modules/h5p/library/h5p.classes.php).
Notice: Trying to get property of non-object in H5PContentValidator->_validateFilelike() (line 3033 of /var/www/drupal7/sites/all/modules/h5p/library/h5p.classes.php).
Warning: Attempt to assign property of non-object in H5PContentValidator->_validateFilelike() (line 3033 of /var/www/drupal7/sites/all/modules/h5p/library/h5p.classes.php).
Notice: Trying to get property of non-object in H5PContentValidator->_validateFilelike() (line 3028 of /var/www/drupal7/sites/all/modules/h5p/library/h5p.classes.php).
Notice: Trying to get property of non-object in H5PContentValidator->_validateFilelike() (line 3033 of /var/www/drupal7/sites/all/modules/h5p/library/h5p.classes.php).
Warning: Creating default object from empty value in H5PContentValidator->_validateFilelike() (line 3033 of /var/www/drupal7/sites/all/modules/h5p/library/h5p.classes.php).
Warning: Invalid argument supplied for foreach() in H5PContentValidator->validateGroup() (line 3120 of /var/www/drupal7/sites/all/modules/h5p/library/h5p.classes.php).
falcon
Wed, 05/25/2016 - 15:15
Permalink
It seems that the poster
graceman9
Thu, 05/26/2016 - 09:31
Permalink
Thanks! It helped me.
Thanks! It helped me.
falcon
Thu, 05/26/2016 - 15:11
Permalink
:)