Skip to content
Snippets Groups Projects
Commit 862b0455 authored by Kristof De Jaeger's avatar Kristof De Jaeger
Browse files

Issue #3422516 by chetan 11, swentel, koffer: Error Warning: Undefined array key "uri"

parent 6f425c20
No related branches found
Tags 1.0.0-alpha19
No related merge requests found
Pipeline #145698 failed
......@@ -75,8 +75,8 @@ class DynamicTypes extends TypePluginBase {
'name' => 'Title',
'content' => 'Content',
'summary' => 'Summary',
'object' => 'Like/Announce/Follow target',
'inReplyTo' => 'Reply link',
'object' => ['label' => 'Like/Announce/Follow target', 'description' => 'This field contains the URL of the object to like/announce/follow.'],
'inReplyTo' => ['label' => 'Reply link', 'description' => 'This field contains the URL to the original post you are replying to.'],
// 'attachment' was originally reserved for 'images' only, but attachments
// can also contain other media types.
'attachment' => ['label' => 'Image attachment', 'property' => 'attachment'],
......@@ -111,7 +111,11 @@ class DynamicTypes extends TypePluginBase {
$properties = $this->getProperties($this->getConfiguration()['object']);
foreach ($properties as $property => $info) {
$description = '';
$label = is_array($info) ? $info['label'] : $info;
if (is_array($info) && !empty($info['description'])) {
$description = $info['description'];
}
$form['field_mapping'][] = [
'property' => [
'#type' => 'value',
......@@ -121,7 +125,8 @@ class DynamicTypes extends TypePluginBase {
'#type' => 'select',
'#title' => $this->t('Property: @property', ['@property' => $label]),
'#options' => $bundle_fields,
'#default_value' => isset($default_mapping[$property]) ? $default_mapping[$property] : '',
'#default_value' => $default_mapping[$property] ?? '',
'#description' => $description,
],
];
}
......
......@@ -237,7 +237,13 @@ abstract class TypePluginBase extends PluginBase implements TypePluginInterface,
break;
case 'object':
case 'inReplyTo':
$return = $value[0]['uri'];
// This can either be a link field or just a text field.
if (!empty($value[0]['uri'])) {
$return = $value[0]['uri'];
}
if (!empty($value[0]['value'])) {
$return = $value[0]['value'];
}
break;
case 'attachment':
$return = [];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment