Core Config Improved
This commit is contained in:
parent
de2f8c8b2f
commit
86f0476b21
|
|
@ -4,6 +4,12 @@ namespace Webkul\Core\Traits;
|
|||
|
||||
trait CoreConfigField
|
||||
{
|
||||
/**
|
||||
* Get name field for forms in configuration page.
|
||||
*
|
||||
* @param string $key
|
||||
* @return string
|
||||
*/
|
||||
public function getNameField($key)
|
||||
{
|
||||
$nameField = '';
|
||||
|
|
@ -15,6 +21,12 @@ trait CoreConfigField
|
|||
return $nameField;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get validations for forms in configuration page.
|
||||
*
|
||||
* @param array $field
|
||||
* @return string
|
||||
*/
|
||||
public function getValidations($field)
|
||||
{
|
||||
return isset($field['validation'])
|
||||
|
|
@ -22,6 +34,12 @@ trait CoreConfigField
|
|||
: '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get value from repositories, if developer wants to do.
|
||||
*
|
||||
* @param array $field
|
||||
* @return mixed
|
||||
*/
|
||||
public function getValueByRepository($field)
|
||||
{
|
||||
if (isset($field['repository'])) {
|
||||
|
|
@ -34,6 +52,13 @@ trait CoreConfigField
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get dependent field or value based on arguments.
|
||||
*
|
||||
* @param array $field
|
||||
* @param string $fieldOrValue
|
||||
* @return string
|
||||
*/
|
||||
public function getDependentFieldOrValue($field, $fieldOrValue = 'field')
|
||||
{
|
||||
$depends = explode(":", $field['depend']);
|
||||
|
|
@ -42,6 +67,13 @@ trait CoreConfigField
|
|||
? current($depends) : end($depends);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get dependent field options.
|
||||
*
|
||||
* @param array $field
|
||||
* @param array $dependentValues
|
||||
* @return mixed
|
||||
*/
|
||||
public function getDependentFieldOptions($field, $dependentValues)
|
||||
{
|
||||
$fieldOptions = null;
|
||||
|
|
@ -64,6 +96,15 @@ trait CoreConfigField
|
|||
: $fieldOptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get channel/locale indicator for form fields. So, that form fields can be detected,
|
||||
* whether it is channel based or locale based or both.
|
||||
*
|
||||
* @param array $field
|
||||
* @param string $channel
|
||||
* @param string $locale
|
||||
* @return string
|
||||
*/
|
||||
public function getChannelLocaleInfo($field, $channel, $locale)
|
||||
{
|
||||
$info = [];
|
||||
|
|
|
|||
Loading…
Reference in New Issue