<?php
namespace nur\v\base;

use nur\A;

trait TComponentPrintable {
  function haveJquery(): bool {
    return static::HAVE_JQUERY;
  }

  function printJquery(): void {
    ?>
<script type="text/javascript">
jQuery.noConflict()(function($) {
});
</script>
<?php
  }

  function haveScript(): bool {
    return static::HAVE_SCRIPT;
  }

  function printScript(): void {
    ?>
<script type="text/javascript">
</script>
<?php
  }

  function prepare(): void {
    $plugins = static::PLUGINS;
    if ($plugins !== null) {
      foreach (A::with($plugins) as $name => $plugin) {
        $this->addPlugin($plugin, $name);
      }
    }
  }
}
