How to use semantics?

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's picture

It seems that the poster field is required for this content type to work, but we think you can remove the other fields, and it will be possible to remove the poster as well in the future.

Thanks! It helped me.

falcon's picture

:)