ConfigSchemaAlterException example

$added_keys = implode(',', array_diff($altered_schema$discovered_schema));
      $removed_keys = implode(',', array_diff($discovered_schema$altered_schema));
      if (!empty($added_keys) && !empty($removed_keys)) {
        $message = "Invoking hook_config_schema_info_alter() has added ($added_keys) and removed ($removed_keys) schema definitions";
      }
      elseif (!empty($added_keys)) {
        $message = "Invoking hook_config_schema_info_alter() has added ($added_keys) schema definitions";
      }
      else {
        $message = "Invoking hook_config_schema_info_alter() has removed ($removed_keys) schema definitions";
      }
      throw new ConfigSchemaAlterException($message);
    }
  }

  /** * {@inheritdoc} */
  public function createFromNameAndData($config_name, array $config_data) {
    $definition = $this->getDefinition($config_name);
    $data_definition = $this->buildDataDefinition($definition$config_data);
    return $this->create($data_definition$config_data$config_name);
  }

}
Home | Imprint | This part of the site doesn't use cookies.