yii\helpers\BaseInflector::camelize PHP Method

camelize() public static method

Returns given word as CamelCased Converts a word like "send_email" to "SendEmail". It will remove non alphanumeric character from the word, so "who's online" will be converted to "WhoSOnline"
See also: variablize()
public static camelize ( string $word ) : string
$word string the word to CamelCase
return string
    public static function camelize($word)
    {
        return str_replace(' ', '', ucwords(preg_replace('/[^A-Za-z0-9]+/', ' ', $word)));
    }

Usage Example

Beispiel #1
0
 public function run()
 {
     $view = $this->getView();
     JsoneditorAsset::register($view);
     $editorName = BaseInflector::camelize($this->id) . 'Editor';
     $view->registerJs("var container = document.getElementById('" . $this->options['id'] . "');\n            var options = " . Json::encode($this->editorOptions) . ";\n            var json = " . $this->value . ";\n            " . $editorName . " = new JSONEditor(container, options, json);\n            jQuery('#" . $this->id . "').parents('form').eq(0).submit(function() {\n                jQuery('#" . $this->id . "').val(" . $editorName . ".getText());\n                return true;\n            });");
     echo Html::hiddenInput($this->name, $this->value, ['id' => $this->id]);
     echo Html::tag('div', '', $this->options);
 }
All Usage Examples Of yii\helpers\BaseInflector::camelize