<object type="application/kenticocloud" data-type="item" data-codename="my_tweet"></object>
link
parameter to get more information about the linked content items.
<?php
// Tip: Find more about PHP SDKs at https://kontent.ai/learn/php
class CustomLinkedItemsResolver implements InlineLinkedItemsResolverInterface
{
public function resolveInlineLinkedItems($input, $item)
{
if(empty($item)){
return $input;
}
switch ($item->system->type) {
case 'tweet':
return "<blockquote class=\"twitter-tweet\" data-lang=\"en\" data-theme=\"".$item->elements->theme->value[0]->codename."\"><a href=\"".$item->elements->tweet_link->value."\"></a></blockquote>";
}
return $input;
}
}
?>
<?php
// Tip: Find more about PHP SDKs at https://kontent.ai/learn/php
$client = new DeliveryClient("<YOUR_ENVIRONMENT_ID>");
$client->inlineLinkedItemsResolver= new CustomLinkedItemsResolver();
?>
<?php
// Tip: Find more about PHP SDKs at https://kontent.ai/learn/php
// Retrieves a content item named 'My article'
$item = $client->getItem('my_article');
// Retrieves text from the 'body' Rich text element
$description = $item->body;
?>
<?php
// Tip: Find more about PHP SDKs at https://kontent.ai/learn/php
class CustomContentLinkUrlResolver implements ContentLinkUrlResolverInterface
{
public function resolveLinkUrl($link)
{
// Resolves URLs to content items based on the Article content type
if ($link->contentTypeCodeName == "my_article") {
return "/articles/". $link->urlSlug;
}
// TODO: Add the rest of the resolver logic
}
public function resolveBrokenLinkUrl()
{
// Resolves URLs to unavailable content items
return "/404";
}
}
?>
<?php
// Tip: Find more about PHP SDKs at https://kontent.ai/learn/php
$client = new DeliveryClient("<YOUR_ENVIRONMENT_ID>");
$client->contentLinkUrlResolver = new CustomContentLinkUrlResolver();
?>
<?php
// Tip: Find more about PHP SDKs at https://kontent.ai/learn/php
// Retrieves a content item named 'My article'
$item = $client->getItem('my_article');
// Retrieves text from the 'body' Rich text element
$description = $item->body;
?>