Преглед на файлове

Update option-functions.php

Adding new calendarlinkurl type and updated makeOptionsFromValues for setting primary URL used when clicking on calendar
Jesse Hickman преди 4 години
родител
ревизия
f909df7f7a
променени са 1 файла, в които са добавени 17 реда и са изтрити 2 реда
  1. 17 2
      api/functions/option-functions.php

+ 17 - 2
api/functions/option-functions.php

@@ -447,6 +447,14 @@ trait OptionsFunction
 					'attr' => 'data-original="' . $this->config[$name] . '"'
 				];
 				break;
+			case 'calendarlinkurl':
+				$settingMerge = [
+					'type' => 'select',
+					'label' => 'Target URL',
+					'help' => 'Set the primary URL used when clicking on calendar icon.',
+					'options' => $this->makeOptionsFromValues($this->config[str_replace('CalendarLink','',$name).'URL'], true, 'Use Default'),
+				];
+				break;
 			default:
 				$settingMerge = [
 					'type' => strtolower($type),
@@ -465,7 +473,14 @@ trait OptionsFunction
 
 	public function makeOptionsFromValues($values = null)
 	{
-		$formattedValues = [];
+		if ($appendBlank === true){
+			$formattedValues[] = [
+				'name' => (!empty($blankLabel)) ? $blankLabel : 'Select option...',
+				'value' => ''
+			];
+		} else {
+			$formattedValues = [];
+		}
 		if (strpos($values, ',') !== false) {
 			$explode = explode(',', $values);
 			foreach ($explode as $item) {
@@ -1312,4 +1327,4 @@ trait OptionsFunction
 			)
 		);
 	}
-}
+}