Browse Source

Fix PHP notices.

8.x-1.x 8.x-1.0-beta6
Alexander O'Neill 3 years ago
parent
commit
8e0aec1db4
  1. 37
      bibcite_footnotes.module

37
bibcite_footnotes.module

@ -76,7 +76,7 @@ function bibcite_footnotes_preprocess_bibcite_footnote_list(&$variables) {
$notes['#attached']['library'][] = 'bibcite_footnotes/reference_footnote'; $notes['#attached']['library'][] = 'bibcite_footnotes/reference_footnote';
$dont_show_backlink_text = $config['reference_dont_show_backlink_text']; $dont_show_backlink_text = $config['reference_dont_show_backlink_text'];
$sort_references_by = $config['reference_sort_by'];
$citation_tools = new CitationTools(); $citation_tools = new CitationTools();
if (empty($footnotes)) { if (empty($footnotes)) {
return; return;
@ -200,7 +200,7 @@ function bibcite_footnotes_preprocess_bibcite_footnote_link(&$variables) {
$title = trim(strip_tags(render($citation_data))); $title = trim(strip_tags(render($citation_data)));
$url = Url::fromUserInput('#' . $fn['fn_id'], ['attributes' => ['id' => $fn['ref_id'], 'class' => $class, 'title' => $title]]); $url = Url::fromUserInput('#' . $fn['fn_id'], ['attributes' => ['id' => $fn['ref_id'], 'class' => $class, 'title' => $title]]);
$link = Link::fromTextAndUrl($fn['value'], $url)->toRenderable(); $link = Link::fromTextAndUrl($fn['value'], $url)->toRenderable();
unset($variables['fn']['fn']); unset($variables['fn']['fn']);
@ -241,21 +241,22 @@ function bibcite_footnotes_form_node_form_alter(&$form, FormStateInterface &$for
/** /**
* @var FieldConfig $field_config * @var FieldConfig $field_config
*/ */
$field_config = $ief_instance['instance']; if ($field_config = $ief_instance['instance']) {
// Check if this is a bibcite_reference field type. // Check if this is a bibcite_reference field type.
if ($field_config->getSetting('handler') == 'default:bibcite_reference') { if ($field_config->getSetting('handler') == 'default:bibcite_reference') {
$field_name = $field_config->get('field_name'); $field_name = $field_config->get('field_name');
if (!empty($ief_instance['entities'])) { if (!empty($ief_instance['entities'])) {
foreach ($ief_instance['entities'] as $entity_wrapper) { foreach ($ief_instance['entities'] as $entity_wrapper) {
/** /**
* @var \Drupal\core\Entity\EntityInterface $entity * @var \Drupal\core\Entity\EntityInterface $entity
*/ */
$entity = $entity_wrapper['entity']; $entity = $entity_wrapper['entity'];
if ($entity->getEntityTypeId() == 'bibcite_reference') { if ($entity->getEntityTypeId() == 'bibcite_reference') {
list($citation_text, $citation_key) = bibcite_footnotes_get_ckeditor_select_item($entity); list($citation_text, $citation_key) = bibcite_footnotes_get_ckeditor_select_item($entity);
$bibcite_references[] = [$citation_text, $citation_key]; $bibcite_references[] = [$citation_text, $citation_key];
}
} }
} }
} }
@ -359,4 +360,4 @@ function _bibcite_footnotes_sort_rendered_references($a, $b) {
return 0; return 0;
} }
return strtolower($a['rendered']) < strtolower($b['rendered']) ? -1 : 1; return strtolower($a['rendered']) < strtolower($b['rendered']) ? -1 : 1;
} }

Loading…
Cancel
Save