Untitled
unknown
plain_text
a year ago
1.4 kB
10
Indexable
Warning: Undefined array key "node_type" in Drupal\hearsay_insights\Plugin\Block\HearsayInsights->build() (line 28 of C:\xampp\htdocs\thrivent-hs\web\modules\custom\hearsay_insights\src\Plugin\Block\HearsayInsights.php)
<?php
namespace Drupal\hearsay_insights\Plugin\Block;
use Drupal\Core\Block\BlockBase;
use Drupal\hearsay_client_customization\Controller\HearsayClientCustomization;
use Drupal\hearsay_common\Controller\HearsayCommon;
/**
* Insights Block.
*
* @Block(
* id = "hearsay_insights",
* admin_label = @Translation("Insights Block"),
* )
*/
class HearsayInsights extends BlockBase
{
/**
* Block created for Insights Section.
* {@inheritdoc}
*/
public function build()
{
$themeAndModuleData = [];
$hearsayClientCustomization = new HearsayClientCustomization();
$hearsayCommon = new HearsayCommon();
if($hearsayCommon->getThemeIdByNode()['node_type'] == 'news')
{
$insightsData = $hearsayCommon->getSocialPostData(TRUE);
} else {
$insightsData = $hearsayCommon->getSocialPostData(FALSE);
}
$themeAndModuleData = $hearsayClientCustomization->getProcessedData(HS_INSIGHTS_MODULE, false);
return [
'#theme' => 'hearsay_insights',
'#items' => $themeAndModuleData,
];
}
public function getCacheMaxAge()
{
return 0;
}
}
Editor is loading...
Leave a Comment