You are here

public function VueBlock::convertKebabCase in Decoupled Blocks: Vue.js 8

Convert camelCase to kebab-case.

See https://vuejs.org/v2/guide/components.html#camelCase-vs-kebab-case.

1 call to VueBlock::convertKebabCase()
VueBlock::buildPropertyString in src/Plugin/Block/VueBlock.php
Create a string of Vue Component property parameters.

File

src/Plugin/Block/VueBlock.php, line 178

Class

VueBlock
Exposes a Vue component as a block.

Namespace

Drupal\pdb_vue\Plugin\Block

Code

public function convertKebabCase($value) {
  return ltrim(strtolower(preg_replace('/[A-Z]([A-Z](?![a-z]))*/', '-$0', $value)), '-');
}