我有一个使用Webform模块创建的调查表。我必须在主页上显示所有带有提交和没有提交带有Webform类别的调查表标题。但是它仅显示提交的调查表标题。如何在drupal 8中显示零提交的Webform标题?
答案 0 :(得分:2)
use below code as a function in your module file and call it on your custom block.
function module_name_webformtitle(){
$query = Drupal::service('entity.query')->get('webform');
$query->condition('category', 'survey_name');//your survey name
$entity_ids = $query->execute();
$webform_id=array();
foreach($entity_ids as $webid){
$webform_id[]=$webid;
}
$webform = Webform::loadMultiple($webform_id);
foreach($webform as $webforms){
$webformtitle=$webforms->get('title');
}
}