Issue #3306820 by matthieuscarset, kulmjens, smustgrave, bernardm28, xjm, quietone, dww, SKAUGHT, BlackBamboo, benjifisher, rkoller, simohell, worldlinemine: Show machine name in "Manage form display" and "Manage display" table row
parent
f355d928bf
commit
e091a2fdd6
|
@ -319,6 +319,10 @@ abstract class EntityDisplayFormBase extends EntityForm {
|
||||||
'human_name' => [
|
'human_name' => [
|
||||||
'#plain_text' => $label,
|
'#plain_text' => $label,
|
||||||
],
|
],
|
||||||
|
'machine_name' => [
|
||||||
|
'#markup' => $field_name,
|
||||||
|
'#attributes' => ['class' => ['machine-name']],
|
||||||
|
],
|
||||||
'weight' => [
|
'weight' => [
|
||||||
'#type' => 'textfield',
|
'#type' => 'textfield',
|
||||||
'#title' => $this->t('Weight for @title', ['@title' => $label]),
|
'#title' => $this->t('Weight for @title', ['@title' => $label]),
|
||||||
|
@ -492,6 +496,10 @@ abstract class EntityDisplayFormBase extends EntityForm {
|
||||||
'human_name' => [
|
'human_name' => [
|
||||||
'#markup' => $extra_field['label'],
|
'#markup' => $extra_field['label'],
|
||||||
],
|
],
|
||||||
|
'machine_name' => [
|
||||||
|
'#markup' => $field_id,
|
||||||
|
'#attributes' => ['class' => ['machine-name']],
|
||||||
|
],
|
||||||
'weight' => [
|
'weight' => [
|
||||||
'#type' => 'textfield',
|
'#type' => 'textfield',
|
||||||
'#title' => $this->t('Weight for @title', ['@title' => $extra_field['label']]),
|
'#title' => $this->t('Weight for @title', ['@title' => $extra_field['label']]),
|
||||||
|
|
|
@ -96,6 +96,10 @@ class EntityFormDisplayEditForm extends EntityDisplayFormBase {
|
||||||
protected function getTableHeader() {
|
protected function getTableHeader() {
|
||||||
return [
|
return [
|
||||||
$this->t('Field'),
|
$this->t('Field'),
|
||||||
|
[
|
||||||
|
'data' => $this->t('Machine name'),
|
||||||
|
'class' => [RESPONSIVE_PRIORITY_MEDIUM, 'machine-name'],
|
||||||
|
],
|
||||||
$this->t('Weight'),
|
$this->t('Weight'),
|
||||||
$this->t('Parent'),
|
$this->t('Parent'),
|
||||||
$this->t('Region'),
|
$this->t('Region'),
|
||||||
|
|
|
@ -130,6 +130,10 @@ class EntityViewDisplayEditForm extends EntityDisplayFormBase {
|
||||||
protected function getTableHeader() {
|
protected function getTableHeader() {
|
||||||
return [
|
return [
|
||||||
$this->t('Field'),
|
$this->t('Field'),
|
||||||
|
[
|
||||||
|
'data' => $this->t('Machine name'),
|
||||||
|
'class' => [RESPONSIVE_PRIORITY_MEDIUM, 'machine-name'],
|
||||||
|
],
|
||||||
$this->t('Weight'),
|
$this->t('Weight'),
|
||||||
$this->t('Parent'),
|
$this->t('Parent'),
|
||||||
$this->t('Region'),
|
$this->t('Region'),
|
||||||
|
|
|
@ -73,6 +73,7 @@ class ManageDisplayTest extends BrowserTestBase {
|
||||||
'administer node display',
|
'administer node display',
|
||||||
'administer taxonomy',
|
'administer taxonomy',
|
||||||
'administer taxonomy_term fields',
|
'administer taxonomy_term fields',
|
||||||
|
'administer taxonomy_term form display',
|
||||||
'administer taxonomy_term display',
|
'administer taxonomy_term display',
|
||||||
'administer users',
|
'administer users',
|
||||||
'administer account settings',
|
'administer account settings',
|
||||||
|
@ -205,9 +206,16 @@ class ManageDisplayTest extends BrowserTestBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests hiding the view modes fieldset when there's only one available.
|
* Tests view mode management screens.
|
||||||
*/
|
*/
|
||||||
public function testSingleViewMode() {
|
public function testViewModeUi(): void {
|
||||||
|
// Tests table headers on "Manage form" and "Manage display" screens.
|
||||||
|
$this->drupalGet('admin/structure/taxonomy/manage/' . $this->vocabulary . '/overview/form-display');
|
||||||
|
$this->assertTableHeaderExistsByLabel('field-display-overview', 'Machine name');
|
||||||
|
$this->drupalGet('admin/structure/taxonomy/manage/' . $this->vocabulary . '/overview/display');
|
||||||
|
$this->assertTableHeaderExistsByLabel('field-display-overview', 'Machine name');
|
||||||
|
|
||||||
|
// Tests hiding the view modes fieldset when there's only one available.
|
||||||
$this->drupalGet('admin/structure/taxonomy/manage/' . $this->vocabulary . '/display');
|
$this->drupalGet('admin/structure/taxonomy/manage/' . $this->vocabulary . '/display');
|
||||||
$this->assertSession()->pageTextNotContains('Use custom display settings for the following view modes');
|
$this->assertSession()->pageTextNotContains('Use custom display settings for the following view modes');
|
||||||
|
|
||||||
|
|
|
@ -266,4 +266,22 @@ trait FieldUiTestTrait {
|
||||||
$this->assertSession()->assert($element === NULL, sprintf('A field "%s" appears on this page, but it should not.', $label));
|
$this->assertSession()->assert($element === NULL, sprintf('A field "%s" appears on this page, but it should not.', $label));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Asserts that a header cell appears on a table.
|
||||||
|
*
|
||||||
|
* @param string $table_id
|
||||||
|
* The HTML attribute value to target a given table.
|
||||||
|
* @param string $label
|
||||||
|
* The cell label.
|
||||||
|
*/
|
||||||
|
protected function assertTableHeaderExistsByLabel(string $table_id, string $label): void {
|
||||||
|
$expression = '//table[@id=:id]//tr//th[1 and text() = :label]';
|
||||||
|
$xpath = $this->assertSession()->buildXPathQuery($expression, [
|
||||||
|
':id' => $table_id,
|
||||||
|
':label' => $label,
|
||||||
|
]);
|
||||||
|
$element = $this->getSession()->getPage()->find('xpath', $xpath);
|
||||||
|
$this->assertSession()->assert($element !== NULL, sprintf('Table header not found by label: "%s".', $label));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue