public function CKEditorMediaEmbedSettingsForm::buildForm in CKEditor Media Embed Plugin 8
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides ConfigFormBase::buildForm
File
- src/
Form/ CKEditorMediaEmbedSettingsForm.php, line 94
Class
- CKEditorMediaEmbedSettingsForm
- Class CKEditorMediaEmbedSettingsForm.
Namespace
Drupal\ckeditor_media_embed\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this
->config('ckeditor_media_embed.settings');
$version = AssetManager::getCKEditorVersion($this->libraryDiscovery, $this->configFactory);
if (!AssetManager::pluginsAreInstalled($version)) {
$this
->messenger()
->addWarning(_ckeditor_media_embed_get_install_instructions());
return [];
}
$form['embed_provider'] = [
'#type' => 'textfield',
'#title' => $this
->t('Provider URL'),
'#default_value' => $config
->get('embed_provider'),
'#description' => $this
->t('A template for the URL of the provider endpoint.
This URL will be queried for each resource to be embedded. By default CKEditor uses the Iframely service.<br />
<em>Note that if you wish to support HTTPS with Iframely then you must create an account. Please read their <a href="https://iframely.com/docs/ckeditor">documentation</a> for more details.</em><br />
<strong>Example</strong> <code>//example.com/api/oembed-proxy?resource-url={url}&callback={callback}&api_token=MYAPITOKEN</code><br />
<strong>Default</strong> <code>http://ckeditor.iframe.ly/api/oembed?url={url}&callback={callback}</code>
<br />
'),
];
if ($this->moduleHandler
->moduleExists('help')) {
$form['embed_provider']['#description'] .= $this
->t('Check out the <a href=":help">help</a> page for more information.<br />', [
':help' => $this->urlGenerator
->generateFromRoute('help.page', [
'name' => 'ckeditor_media_embed',
]),
]);
}
return parent::buildForm($form, $form_state);
}