Create the slug

@return void
190787
protected function _createSlug()
    {
        //Regenerate the slug
        if($this->isModified('slug')) {
            $this->slug = $this->_createFilter()->sanitize($this->slug);
        }

        //Handle empty slug
        if(empty($this->slug))
        {
            $slugs = array();
            foreach($this->_columns as $column) {
                $slugs[] = $this->_createFilter()->sanitize($this->$column);
            }

            $this->slug = implode($this->_separator, array_filter($slugs));
        }

        //Canonicalize the slug
        if($this->_unique) {
            $this->_canonicalizeSlug();
        }
    }
1351564
public function generateSlugSegmentationAndPath()
    {
        // Set slug for this Account.  The reason we do this here is that
        // the slug listener hasn't been called yet
        $this->setSlug(\Gedmo\Sluggable\Util\Urlizer::urlize($this->name));

        if ($this->getParent()) {
            $account = $this;

            $pathSegments = array($account->getSlug());
            $nameSegments = array($account->getName());

            while ($account->getParent()) {
                $account        = $account->getParent();

                // Don't include root
                if ($account->getParent()) {
                    $pathSegments[] = $account->getSlug();
                    $nameSegments[] = $account->getName();
                }
            }

            $this->setPath(implode('/', array_reverse($pathSegments)));
            $this->setSegmentation(implode(':', array_reverse($nameSegments)));
        } else {
            $this->setPath('/');
            $this->setSegmentation(':');
        }
    }
400133
private function createRoutes()
    {
        $this->routeCollection->add('_content', new Route('/{slug}', [
            '_controller' => 'OpiferContentBundle:Frontend/Content:view',
            'slug'        => '',
        ], [
            'slug'        => "[a-zA-Z0-9\-_\/]*",
        ], [
            'expose'      => true,
        ]));
        $this->routeCollection->add('home', new Route('/', [
            '_controller' => 'OpiferContentBundle:Frontend/Content:view',
            'slug'        => '',
        ], [
            'slug'        => "[a-zA-Z0-9\-_\/]*",
        ], [
            'expose'      => true,
        ]));
    }
917926
public function create()
    {
        $slug = $this->getParameter('value');
        $allowSlashes = StringUtils::strToBool($this->getParameter('allowSlashes'));

        return SlugUtils::createSlug($slug,$allowSlashes);
    }
729189
public function actionCreate( $slug ) {

        $post   = $this->modelService->getBySlug( $slug, true );

        $this->view->params[ 'model' ]  = $post;

        $this->view->params[ 'step' ]   = 'content';

        if( isset( $post ) ) {

            $model          = new Block();
            $modelBlock     = new ModelBlock();

            $model->siteId  = Yii::$app->core->site->id;

            if( $model->load( Yii::$app->request->post(), $model->getClassName() ) ) {

                $this->blockService->create( $model );

                $modelBlock->modelId    = $model->id;
                $modelBlock->parentId   = $post->id;
                $modelBlock->parentType = $post->type;

                $this->modelBlockService->create( $modelBlock );

                // Create Gallery
                $gallery            = new Gallery();
                $gallery->name      = $model->name;
                $gallery->siteId    = Yii::$app->core->siteId;
                $modelGallery       = $this->modelGalleryService->create( $gallery, [ 'parentId' => $model->id, 'parentType' => CmsGlobal::TYPE_BLOG_CONTENT ] );

                return $this->redirect( [ "update?slug=$model->slug&pslug=$post->slug" ] );
            }

            return $this->render( 'create', [
                'model' => $model,
                'post' => $post
            ] );
        }

        // Error- Page not found
		throw new NotFoundHttpException( Yii::$app->coreMessage->getMessage( CoreGlobal::ERROR_NOT_FOUND ) );
    }
1331148
public function create()
    {
        $instance = self::createCategory($this);
        $this->setId($instance->getId());
        return $instance;
    }
1171087
public function actionCreate()
    {
        $user = new User();
        $this->readValue($user, 'username');
        $this->readValue($user, 'email');
        $user->setPassword($this->prompt('Password:', [
            'required' => true,
            'pattern'  => '#^.{6,255}$#i',
            'error'    => 'More than 6 symbols',
        ]));
        $user->generateAuthKey();
        $user->status = User::STATUS_ACTIVE;
        $this->log($this->repository->save($user));
    }
1319150
public function slug(){
		if (is_null($this->slug)){
			$hashids = $this->getHashids();

			$this->slug = $hashids->encode($this->{$this->getKeyName()});
		}

		return $this->slug;
	}
156919
def save(self, *args, **kwargs):
        
        self.slug = self.create_slug()
        super(Slugable, self).save(*args, **kwargs)
1369108
public static function boot()
    {
        parent::boot();

        static::creating(function ($business) {

            $business->slug = $business->makeSlug($business->name);

        });
    }
107832
public function create()
	{
		// Element fields, so don´t use parent construct method
		$GLOBALS['TL_DCA']['tl_content']['palettes'][$this->element] .= ',invisible';
		$GLOBALS['TL_DCA']['tl_content']['fields']['invisible']['eval']['tl_class'] = 'clr'; // push to new row (clear)
	
		// The start field
		if ($this->canChangeStart)
		{
			$GLOBALS['TL_DCA']['tl_content']['palettes'][$this->element] .= ',start';
		}
		// The stop field
		if ($this->canChangeStop)
		{
			$GLOBALS['TL_DCA']['tl_content']['palettes'][$this->element] .= ',stop';
		}		
	}
1225309
protected function generateSlugOnCreate()
    {
        $this->slugOptions = $this->getSlugOptions();

        if (!$this->slugOptions->generateSlugOnCreate) {
            return;
        }

        $this->createSlug();
    }
902110
protected function _canonicalizeSlug()
    {
        $table = $this->getTable();

        //If the slug needs to be unique and it already exists, make it unique
        $query = $this->getObject('lib:database.query.select');
        $query->where('slug = :slug')->bind(array('slug' => $this->slug));

        if (!$this->isNew())
        {
            $query->where($table->getIdentityColumn().' <> :id')
                ->bind(array('id' => $this->id));
        }

        if($table->count($query))
        {
            $length = $this->_length ? $this->_length : $table->getColumn('slug')->length;

            // Cut 4 characters to make space for slug-1 slug-23 etc
            if ($length && strlen($this->slug) > $length-4) {
                $this->slug = substr($this->slug, 0, $length-4);
            }

            $query = $this->getObject('lib:database.query.select')
                ->columns('slug')
                ->where('slug LIKE :slug')
                ->bind(array('slug' => $this->slug . '-%'));

            $slugs = $table->select($query, Database::FETCH_FIELD_LIST);

            $i = 1;
            while(in_array($this->slug.'-'.$i, $slugs)) {
                $i++;
            }

            $this->slug = $this->slug.'-'.$i;
        }
    }
302546
public function actionCreate($slug, $category_id = null)
    {
        $model = $slug == Category::SLUG ? $this->getCategoryModel() : $this->getItemModel($category_id);
        $modelCategory = $this->getCategoryModel();
        $currentCategory = empty($category_id) ? null : $modelCategory::findOne(['id' => $category_id]);

        $this->scenarios($model);

        if ($model->load(Yii::$app->request->post())) {
            if(Yii::$app->request->isAjax){
                Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
                return ActiveForm::validate($model);
            }
            else{
                if(isset($_FILES)){
                    $this->saveFiles($model);
                }
                if($model->save()){
                    $this->trigger(self::EVENT_AFTER_SAVE, new EventController(['model' => $model]));
                    $this->flash('success', Yii::t('gr', 'Post created'));
                    return $this->redirect(Url::previous());
                }
                else{
                    $this->flash('error', Yii::t('gr', 'Error'));
                    return $this->refresh();
                }
            }
        }
        else {
            if($slug == Category::SLUG){
                $title = empty($currentCategory) ? Yii::t('gr', 'Create subcategory in the top-level category') : Yii::t('gr', 'Create Subcategory in Category <b>«{0}»</b>', [$currentCategory->title]);
            }else{
                $title = empty($currentCategory) ? Yii::t('gr', 'Create an item in the top-level category') : Yii::t('gr', 'Create Item in Category <b>«{0}»</b>', [$currentCategory->title]);
            }

            return $this->render('create', [
                'model' => $model,
                'currentCategory' => $currentCategory,
                'title' => $title
            ]);
        }
    }
401414
public function build()
    {
        $this->isValidField($this->classMetadata, $this->fieldName);

        $this->classMetadata->appendExtension($this->getExtensionName(), [
            'slugs' => [
                $this->fieldName => $this->makeConfiguration(),
            ],
        ]);
    }
891018
private function add_slugify_helper() {
		$this->engine->addHelper(
			'slugify',
			function ( $template, $context, $args ) {
					$arg = $context->get( $args );
					return slugify( $arg );
			}
		);
	}
51746
public function run()
    {
        $dataType = DataType::where('slug', 'posts')->firstOrFail();

        if (!$dataType->exists) {
            return false;
        }

        FormDesigner::firstOrCreate([
            'data_type_id' => $dataType->id,
            'options'      => json_encode([
                [
                    'class'  => 'col-md-8',
                    'panels' => [
                        [
                            'class'  => 'panel',
                            'title'  => '<i class="admin-character"></i> Post Title The title for your post',
                            'fields' => [
                                'title',
                            ],
                        ],
                        [
                            'class'  => 'panel',
                            'title'  => 'Post Content',
                            'fields' => [
                                'body',
                            ],
                        ],
                        [
                            'class'  => 'panel',
                            'title'  => 'Excerpt <small>Small description of this post</small>',
                            'fields' => [
                                'excerpt',
                            ],
                        ],
                    ],
                ],
                [
                    'class'  => 'col-md-4',
                    'panels' => [
                        [
                            'class'  => 'panel panel-warning',
                            'title'  => 'Post Details',
                            'fields' => [
                                'slug',
                                'status',
                                'category_id',
                                'featured',
                            ],
                        ],
                        [
                            'class'  => 'panel panel-primary',
                            'title'  => 'Post Image',
                            'fields' => [
                                'image',
                            ],
                        ],
                        [
                            'class'  => 'panel panel-info',
                            'title'  => 'admin.post.seo_content',
                            'fields' => [
                                'meta_keywords',
                                'meta_description',
                                'seo_title',
                            ],
                        ],
                    ],
                ],
            ]),
        ]);
    }