Score:0

Programmatically add Views block to field group

ธง jp

I want to programmatically add a view to a field group I created using the field_group module. I created an group_articles tab field group.

When I do this something like hook_form_alter:

    $form['issues__articles'] = array(
      '#type' => 'fieldgroup',
      '#weight' => 0,
    );
    $form['issues__articles']['view'] = [
      '#type' => 'view',
      '#name' => 'view_admin',
      '#display_id' => 'block_1',
      '#weight' => 0,
    ];
    $form['issues__articles']['#group'] = 'group_articles';

My view is added to my premade group_articles group, inside a programmatically created fieldset. I can change fieldgroup in my code into details and this would also work. But I don't want a fieldset or details container I want the view without a container or a simple html element like div and then inside my group_articles tab.

Changing fieldgroup to html_element doesn't work and removing the first part like this:

$form['issues__articles']['view'] = [
  '#type' => 'view',
  '#name' => 'view_admin',
  '#display_id' => 'block_1',
  '#weight' => 0,
];
$form['issues__articles']['#group'] = 'group_articles';

Or:

$form['issues__articles'] = [
          '#type' => 'view',
          '#name' => 'view_admin',
          '#display_id' => 'block_1',
          '#weight' => 0,
        ];
        $form['issues__articles']['#group'] = 'group_articles';

Also doesn't work, how can I fix this?

โพสต์คำตอบ

คนส่วนใหญ่ไม่เข้าใจว่าการถามคำถามมากมายจะปลดล็อกการเรียนรู้และปรับปรุงความสัมพันธ์ระหว่างบุคคล ตัวอย่างเช่น ในการศึกษาของ Alison แม้ว่าผู้คนจะจำได้อย่างแม่นยำว่ามีคำถามกี่ข้อที่ถูกถามในการสนทนา แต่พวกเขาไม่เข้าใจความเชื่อมโยงระหว่างคำถามและความชอบ จากการศึกษาทั้ง 4 เรื่องที่ผู้เข้าร่วมมีส่วนร่วมในการสนทนาด้วยตนเองหรืออ่านบันทึกการสนทนาของผู้อื่น ผู้คนมักไม่ตระหนักว่าการถามคำถามจะมีอิทธิพลหรือมีอิทธิพลต่อระดับมิตรภาพระหว่างผู้สนทนา