/** * Create a block type. * * @param string $type * Type of the block. * * @When /^I create the new block type "([^"]*)"$/ */ public function iCreateTheNewBlockType($type) { $plugin_info = _bean_admin_default_plugin(); $plugin_info['name'] = ''; $bean_type = new \BeanCustom($plugin_info); $bean_type->type = substr(str_pad(substr($this->transliterate->getMachineName($type), 0, 32), 32, '_'), 0, 23) . '_' . $this->transliterate->getMachineName($this->random->getRandomString(8)); $bean_type->setLabel($type); $bean_type->setDescription('Behat'); $bean_type->save(TRUE); }
/** * Get the Taxonomy Id by the name. * * @param string $name * Name of the taxonomy. * * @return string * Id of the taxonomy. */ private function getTaxonomyIdByName($name) { $vocabulary = taxonomy_vocabulary_machine_name_load($this->transliterate->getMachineName($name)); if (empty($vocabulary)) { throw new \InvalidArgumentException("The vocabulary '{$name}' doesn't exist."); } return $vocabulary->vid; }