Skip to content

Commit

Permalink
feat(slb-495): remove obsolete hook
Browse files Browse the repository at this point in the history
  • Loading branch information
dspachos committed Nov 26, 2024
1 parent e94e53a commit 3e766f0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'silverback_ai_import'
name: 'Silverback Import AI'
type: module
description: 'Silverback AI content import and more'
package: Silverback
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,7 @@ use Drupal\Core\Form\FormStateInterface;
* {@inheritdoc}
*/
function silverback_ai_import_form_alter(&$form, &$form_state, $form_id) {

if ($form_id == 'views_exposed_form') {
$file = \Drupal::entityTypeManager()->getStorage('file')->load(123);
// $entity = Node::load(96);
// $block_parser = new BlockParser();
// $blocks = $block_parser->parse($entity->body->value);
$service = \Drupal::service('silverback_ai_import.content');
// $service->import($file, $entity);
$ast = $service->getAstFromFilePath($file);
// Header example.
$chunk = reset($ast->content);
$chunk = json_decode(json_encode($chunk), TRUE);

$manager = \Drupal::service('plugin.manager.ai.import');
$definitions = $manager->getDefinitions();
foreach ($definitions as $definition) {
$plugin = $manager->createInstance($definition['id']);
// dpm($plugin->matches($chunk));
}
// $plugin = $manager->createInstance('ai_header', ['level' => 2]);
$plugin = $manager->createInstance('ai_header');
// dpm($plugin->convert($chunk));
}

// @todo
}

/**
Expand Down

0 comments on commit 3e766f0

Please sign in to comment.