Altering semantics only if in compound content type

sanderaido's picture


Is there any way to check whether the content type is "inside" another content type and alter it's semantics accordingly? For example change some default options of Fill in the blanks but only if it is inside a Column type. The h5p_semantics_alter hook doesn't seem to have any context about where it is run, so is this possible at all?

I'm using Drupal 7. Something like:

function mod_h5p_semantics_alter(&$semantics, $machine_name) {
  if ($machine_name == 'H5P.Blanks'){
    // Check if parent/context is 'H5P.Column'
      // alter $semantics


icc's picture


Unfortunately, there is no context. To achieve what you want you'll probably want to add a custom editor widget for the Column, where you can customize things to your liking.