Skip to content
Snippets Groups Projects
Commit b34bcec0 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2030645 by lokeoke, Mile23, tim.plunkett, miraj9093, slv_ | plopesc:...

Issue #2030645 by lokeoke, Mile23, tim.plunkett, miraj9093, slv_ | plopesc: Fixed Expand Menu with methods.
parent 585e025e
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -128,7 +128,7 @@ public function form(array $form, FormStateInterface $form_state) { ...@@ -128,7 +128,7 @@ public function form(array $form, FormStateInterface $form_state) {
'#type' => 'textfield', '#type' => 'textfield',
'#title' => t('Administrative summary'), '#title' => t('Administrative summary'),
'#maxlength' => 512, '#maxlength' => 512,
'#default_value' => $menu->description, '#default_value' => $menu->getDescription(),
); );
$form['langcode'] = array( $form['langcode'] = array(
......
...@@ -39,7 +39,7 @@ public function buildRow(EntityInterface $entity) { ...@@ -39,7 +39,7 @@ public function buildRow(EntityInterface $entity) {
'data' => $this->getLabel($entity), 'data' => $this->getLabel($entity),
'class' => array('menu-label'), 'class' => array('menu-label'),
); );
$row['description'] = Xss::filterAdmin($entity->description); $row['description'] = Xss::filterAdmin($entity->getDescription());
return $row + parent::buildRow($entity); return $row + parent::buildRow($entity);
} }
......
...@@ -60,7 +60,7 @@ public function testMenuBlock() { ...@@ -60,7 +60,7 @@ public function testMenuBlock() {
// Verify that after modifying the menu, there is a cache miss. // Verify that after modifying the menu, there is a cache miss.
$this->pass('Test modification of menu.', 'Debug'); $this->pass('Test modification of menu.', 'Debug');
$menu->label = 'Awesome llama'; $menu->set('label', 'Awesome llama');
$menu->save(); $menu->save();
$this->verifyPageCache($path, 'MISS'); $this->verifyPageCache($path, 'MISS');
......
...@@ -41,7 +41,7 @@ public function testMenu() { ...@@ -41,7 +41,7 @@ public function testMenu() {
$navigation_menu = Menu::load('navigation'); $navigation_menu = Menu::load('navigation');
$this->assertEqual($navigation_menu->id(), 'navigation'); $this->assertEqual($navigation_menu->id(), 'navigation');
$this->assertEqual($navigation_menu->label(), 'Navigation'); $this->assertEqual($navigation_menu->label(), 'Navigation');
$this->assertEqual($navigation_menu->description , 'The navigation menu is provided by Drupal and is the main interactive menu for any site. It is usually the only menu that contains personalized links for authenticated users, and is often not even visible to anonymous users.'); $this->assertEqual($navigation_menu->getDescription() , 'The navigation menu is provided by Drupal and is the main interactive menu for any site. It is usually the only menu that contains personalized links for authenticated users, and is often not even visible to anonymous users.');
// Test that we can re-import using the ConfigEntityBase destination. // Test that we can re-import using the ConfigEntityBase destination.
Database::getConnection('default', 'migrate') Database::getConnection('default', 'migrate')
......
...@@ -34,21 +34,21 @@ class Menu extends ConfigEntityBase implements MenuInterface { ...@@ -34,21 +34,21 @@ class Menu extends ConfigEntityBase implements MenuInterface {
* *
* @var string * @var string
*/ */
public $id; protected $id;
/** /**
* The human-readable name of the menu entity. * The human-readable name of the menu entity.
* *
* @var string * @var string
*/ */
public $label; protected $label;
/** /**
* The menu description. * The menu description.
* *
* @var string * @var string
*/ */
public $description; protected $description;
/** /**
* The locked status of this menu. * The locked status of this menu.
...@@ -57,6 +57,13 @@ class Menu extends ConfigEntityBase implements MenuInterface { ...@@ -57,6 +57,13 @@ class Menu extends ConfigEntityBase implements MenuInterface {
*/ */
protected $locked = FALSE; protected $locked = FALSE;
/**
* {@inheritdoc}
*/
public function getDescription() {
return $this->description;
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
......
...@@ -14,6 +14,14 @@ ...@@ -14,6 +14,14 @@
*/ */
interface MenuInterface extends ConfigEntityInterface { interface MenuInterface extends ConfigEntityInterface {
/**
* Returns the description of the menu.
*
* @return string
* Description of the menu.
*/
public function getDescription();
/** /**
* Determines if this menu is locked. * Determines if this menu is locked.
* *
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment