',
esc_html__('Add your X (Twitter) handle and paid API credentials to display the feed.', 'addons-for-divi')
);
} else {
$items = TwitterApi::get_tweets($key, $secret, $user, $limit);
$items = TwitterApi::sort_and_limit($items, $sort_by, $limit);
if (empty($items)) {
$inner = sprintf(
'',
esc_html__('No tweets found. Check the username and that your X API plan allows reading timelines.', 'addons-for-divi')
);
} else {
$inner = sprintf(
'',
esc_attr($align),
TwitterApi::build_items_html($advanced, $items)
);
}
}
$children = sprintf('', $inner);
return Module::render(
[
'orderIndex' => $block->parsed_block['orderIndex'] ?? 0,
'storeInstance' => $block->parsed_block['storeInstance'] ?? null,
'attrs' => $attrs,
'elements' => $elements,
'id' => $block->parsed_block['id'] ?? '',
'name' => $block->block_type->name ?? '',
'moduleClassName' => 'dtq_twitter_feed',
'classnamesFunction' => [self::class, 'module_classnames'],
'stylesComponent' => [self::class, 'module_styles'],
'scriptDataComponent' => [self::class, 'module_script_data'],
'children' => [
$elements->style_components(['attrName' => 'module']),
$children,
],
]
);
}
}