Add isAvailable() to DocumentLoaderInterface
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3574450. -->
Reported by: [ahmad khader](https://www.drupal.org/user/3727855)
Related to !5
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>Add an <code>isAvailable(): bool</code> method to <code>DocumentLoaderInterface</code> so that loader plugins can report whether their runtime dependencies are satisfied. The plugin manager should skip unavailable loaders when resolving a loader for a given document type.</p>
<h3>Problem</h3>
<p>Document loader plugins may depend on external binaries, PHP extensions, or third-party libraries that are not always present. There is currently no way for a plugin to signal that it cannot operate in the current environment.</p>
<p><strong>Example 1 — LLM-based loader:</strong> A loader that delegates extraction to an LLM provider (e.g. GPT-4 Vision, Claude) requires a valid API key and a reachable endpoint. If the API key is not configured or the provider service is not installed, the loader should report itself as unavailable rather than failing at <code>load()</code> time.</p>
<p><strong>Example 2 — External conversion server:</strong> A loader that sends documents to a remote service (e.g. Apache Tika, Gotenberg, a self-hosted LibreOffice headless instance) should be able to check connectivity or configuration before being selected as the active loader.</p>
<p><strong>Example 3 — Local binary dependency:</strong> A PDF loader that shells out to <code>pdftotext</code> or <code>pdftohtml</code> should verify the binary exists on the system. Without <code>isAvailable()</code>, the plugin manager may select it as the default loader, and callers get an opaque runtime error.</p>
<h4 id="summary-steps-reproduce">Steps to reproduce</h4>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<ul>
<li>Add <code>isAvailable(): bool</code> to <code>DocumentLoaderInterface</code>.</li>
<li><code>DocumentLoaderBase</code> returns <code>TRUE</code> by default — plugins override only when they have external dependencies.</li>
<li><code>DocumentLoaderPluginManager::getLoaderByType()</code> checks <code>isAvailable()</code> before returning a loader instance, and continues to the next candidate if it returns <code>FALSE</code>.</li>
</ul>
<h3 id="summary-remaining-tasks">Remaining tasks</h3>
<h3 id="summary-ui-changes">User interface changes</h3>
<h3 id="summary-api-changes">API changes</h3>
<h3 id="summary-data-model-changes">Data model changes</h3>
issue