|
|
@ -35,7 +35,7 @@ use Symfony\Component\HttpFoundation\Request; |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
class IIIFManifest extends StylePluginBase { |
|
|
|
class IIIFManifest extends StylePluginBase { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Islandora utility functions. |
|
|
|
* Islandora utility functions. |
|
|
|
* |
|
|
|
* |
|
|
|
* @var \Drupal\islandora\IslandoraUtils |
|
|
|
* @var \Drupal\islandora\IslandoraUtils |
|
|
@ -285,11 +285,12 @@ class IIIFManifest extends StylePluginBase { |
|
|
|
* Try to fetch the IIIF metadata for the image. |
|
|
|
* Try to fetch the IIIF metadata for the image. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param string $iiif_url |
|
|
|
* @param string $iiif_url |
|
|
|
* Base URL of the canvas |
|
|
|
* Base URL of the canvas. |
|
|
|
* @param FieldItemInterface $image |
|
|
|
* @param \Drupal\Core\Field\FieldItemInterface $image |
|
|
|
* The image field. |
|
|
|
* The image field. |
|
|
|
* @param string $mime_type |
|
|
|
* @param string $mime_type |
|
|
|
* The mime type of the image. |
|
|
|
* The mime type of the image. |
|
|
|
|
|
|
|
* |
|
|
|
* @return [string] |
|
|
|
* @return [string] |
|
|
|
* The width and height of the image. |
|
|
|
* The width and height of the image. |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -326,13 +327,13 @@ class IIIFManifest extends StylePluginBase { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Retrieves a URL text with positional data such as hOCR |
|
|
|
* Retrieves a URL text with positional data such as hOCR. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param EntityInterface $entity |
|
|
|
* @param \Drupal\Core\Entity\EntityInterface $entity |
|
|
|
* The entity at the current row. |
|
|
|
* The entity at the current row. |
|
|
|
* @param \Drupal\taxonomy\TermInterface|null $structured_text_term |
|
|
|
* @param \Drupal\taxonomy\TermInterface|null $structured_text_term |
|
|
|
* The term that structured text media references, if any. |
|
|
|
* The term that structured text media references, if any. |
|
|
|
|
|
|
|
* |
|
|
|
* return String|FALSE |
|
|
|
* return String|FALSE |
|
|
|
* The absolute URL of the current row's structured text, |
|
|
|
* The absolute URL of the current row's structured text, |
|
|
|
* or FALSE if none. |
|
|
|
* or FALSE if none. |
|
|
@ -350,7 +351,7 @@ class IIIFManifest extends StylePluginBase { |
|
|
|
$ocr_url = $ocr->entity->createFileUrl(FALSE); |
|
|
|
$ocr_url = $ocr->entity->createFileUrl(FALSE); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else if ($structured_text_term) { |
|
|
|
elseif ($structured_text_term) { |
|
|
|
$parent_node = $this->utils->getParentNode($entity); |
|
|
|
$parent_node = $this->utils->getParentNode($entity); |
|
|
|
$ocr_entity_array = $this->utils->getMediaReferencingNodeAndTerm($parent_node, $structured_text_term); |
|
|
|
$ocr_entity_array = $this->utils->getMediaReferencingNodeAndTerm($parent_node, $structured_text_term); |
|
|
|
$ocr_entity_id = is_array($ocr_entity_array) ? array_shift($ocr_entity_array) : NULL; |
|
|
|
$ocr_entity_id = is_array($ocr_entity_array) ? array_shift($ocr_entity_array) : NULL; |
|
|
@ -487,6 +488,17 @@ class IIIFManifest extends StylePluginBase { |
|
|
|
return ['json' => 'json']; |
|
|
|
return ['json' => 'json']; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Submit handler for options form. |
|
|
|
|
|
|
|
* Used to store the structured text media term by URL instead of Ttid. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param array $form |
|
|
|
|
|
|
|
* The form. |
|
|
|
|
|
|
|
* @param \Drupal\Core\Form\FormStateInterface $form_state |
|
|
|
|
|
|
|
* The form state object. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @return void |
|
|
|
|
|
|
|
*/ |
|
|
|
public function submitOptionsForm(&$form, FormStateInterface $form_state) { |
|
|
|
public function submitOptionsForm(&$form, FormStateInterface $form_state) { |
|
|
|
$style_options = $form_state->getValue('style_options'); |
|
|
|
$style_options = $form_state->getValue('style_options'); |
|
|
|
$tid = $style_options['structured_text_term']; |
|
|
|
$tid = $style_options['structured_text_term']; |
|
|
|