From c12186c967ae6e6bf50aa54d9229bcac19c8997a Mon Sep 17 00:00:00 2001 From: wilsonge Date: Sat, 19 Oct 2019 11:59:26 +0100 Subject: [PATCH] Make meta description and meta keywords have defaults - Fixes #26650 - Makes fields optional when creating articles in the API --- libraries/src/Table/Content.php | 9 +++++++++ tests/Codeception/api/com_content/ContentCest.php | 2 -- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/libraries/src/Table/Content.php b/libraries/src/Table/Content.php index da2f1acf7a592..4ab79c4bef585 100644 --- a/libraries/src/Table/Content.php +++ b/libraries/src/Table/Content.php @@ -302,6 +302,15 @@ public function check() // Put array back together delimited by ", " $this->metakey = implode(', ', $clean_keys); } + else + { + $this->metakey = ''; + } + + if ($this->metadesc === null) + { + $this->metadesc = ''; + } return true; } diff --git a/tests/Codeception/api/com_content/ContentCest.php b/tests/Codeception/api/com_content/ContentCest.php index a234c45eb08ec..bbfcb7c360b94 100644 --- a/tests/Codeception/api/com_content/ContentCest.php +++ b/tests/Codeception/api/com_content/ContentCest.php @@ -65,8 +65,6 @@ public function testCrudOnArticle(ApiTester $I) 'title' => 'Just for you', 'catid' => 2, 'articletext' => 'A dummy article to save to the database', - 'metakey' => '', - 'metadesc' => '', 'language' => '*', 'alias' => 'tobias' ];