Last active
December 27, 2015 10:39
-
-
Save datacodesolutions/7312792 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace Studiobanks; | |
class Fields | |
{ | |
public static function createEntity() { | |
// $field = entity_create('field_entity', [ | |
// 'id' => 'field_text_slug', | |
// 'name' => 'field_text_slug', | |
// 'entity_type' => 'node', | |
// 'type' => 'text', | |
// 'cardinality' => 1 | |
// ]); | |
// $field->save(); | |
// entity_create('field_instance', [ | |
// 'field_name' => 'field_text_slug', | |
// 'entity_type' => 'node', | |
// 'field_uuid' => 'node', | |
// 'bundle' => 'blog_post' | |
// ])->save(); | |
$node = \Drupal::entityManager() | |
->getStorageController('node') | |
->create([ | |
'title' => 'Some node', | |
'bundle' => 'blog_post', | |
]); | |
$test = true; | |
} | |
public static function createCategorySlugTable() | |
{ | |
db_create_table('category_slug', [ | |
'fields' => [ | |
'category' => [ | |
'description' => 'Category', | |
'type' => 'varchar', | |
'length' => 255, | |
'not null' => FALSE, | |
'default' => '', | |
], | |
'category_slug' => [ | |
'description' => 'Category Slug', | |
'type' => 'varchar', | |
'length' => 255, | |
'not null' => FALSE, | |
'default' => '', | |
], | |
] | |
]); | |
echo 'Category Slug Field Created' . "\n"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment