optional configuration ad name

This commit is contained in:
vedatakd 2021-07-02 17:41:47 +03:00
parent c3b005f48c
commit dfa4e06daa
2 changed files with 6 additions and 4 deletions

View File

@ -4,5 +4,5 @@ use Anomaly\Streams\Platform\Entry\Contract\EntryInterface;
interface OptionConfigurationInterface extends EntryInterface interface OptionConfigurationInterface extends EntryInterface
{ {
public function getName(); public function getName($add_name = true);
} }

View File

@ -13,10 +13,10 @@ class OptionConfigurationModel extends AdvsOptionConfigurationEntryModel impleme
public function getOptionNameAttribute() public function getOptionNameAttribute()
{ {
return $this->getName(); return $this->getName(false);
} }
public function getName() public function getName($add_name = true)
{ {
if ($adv = app(AdvRepositoryInterface::class)->find($this->parent_adv_id)) { if ($adv = app(AdvRepositoryInterface::class)->find($this->parent_adv_id)) {
$configurations_item = json_decode($this->option_json, true); $configurations_item = json_decode($this->option_json, true);
@ -27,7 +27,9 @@ class OptionConfigurationModel extends AdvsOptionConfigurationEntryModel impleme
$option_group_value .= " " . $value_entry->getName(); $option_group_value .= " " . $value_entry->getName();
} }
return $adv->name . ' | ' . trim($option_group_value, ' '); $name = trim($option_group_value, ' ');
return ($add_name) ? $adv->name . ' | ' . $name : $name;
} }
return null; return null;
} }