/** * Test the link output. */ public function testLinkLocation() { // Turn off all link output for the flag. $flag_config = $this->flag->getFlagTypePlugin()->getConfiguration(); $flag_config['show_as_field'] = FALSE; $flag_config['show_in_links'] = []; $this->flag->getFlagTypePlugin()->setConfiguration($flag_config); $this->flag->save(); // Check the full node shows no flag link. $this->drupalGet('node/' . $this->node->id()); $this->assertNoPseudofield($this->flag, $this->node); // TODO: check no entity link. // Check the teaser view mode for the node shows no flag link. $this->drupalGet('node'); $this->assertNoPseudofield($this->flag, $this->node); // TODO: check no entity link. // Turn on 'show as field'. // By default, this will be visible on the field display configuration. $flag_config = $this->flag->getFlagTypePlugin()->getConfiguration(); $flag_config['show_as_field'] = TRUE; $flag_config['show_in_links'] = []; $this->flag->getFlagTypePlugin()->setConfiguration($flag_config); $this->flag->save(); // Check the full node shows the flag link as a field. $this->drupalGet('node/' . $this->node->id()); $this->assertPseudofield($this->flag, $this->node); // TODO: check no entity link. // Check the teaser view mode shows the flag link as a field. $this->drupalGet('node'); $this->assertPseudofield($this->flag, $this->node); // TODO: check no entity link. // Hide the flag field on teaser view mode. $edit = [ 'fields[flag_' . $this->flag->id() . '][type]' => 'hidden', ]; $this->drupalPostForm('admin/structure/types/manage/article/display/teaser', $edit, $this->t('Save')); // Check the form was saved successfully. $this->assertText('Your settings have been saved.'); // Check the full node still shows the flag link as a field. $this->drupalGet('node/' . $this->node->id()); $this->assertPseudofield($this->flag, $this->node); // TODO: check no entity link. // Check the teaser view mode does not show the flag link as a field. $this->drupalGet('node'); $this->assertNoPseudofield($this->flag, $this->node); // TODO: check no entity link. // TODO: // Turn on the entity link, and turn off the field. // Check the full and teaser view modes. // Turn off the entity link for one view mode. // Check both view modes are as expected. }