Giter VIP home page Giter VIP logo

tagbundle's Introduction

Coosos/TagBundle

SensioLabsInsight

TagBundle is a bundle created from the Grafikart video.

Requirements

Installation

Step 1 : Download the bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle :

$ composer require coosos/tag-bundle

This command is used if composer is installed in your system.

Step 2: Enable the Bundle

Then, enable the bundle by adding the following line in the app/AppKernel.php file of your project :

// app/AppKernel.php
// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...
            new Coosos\TagBundle\CoososTagBundle(),
        );
        // ...
    }
    // ...
}

Step 3: Insert tag entity in your database

Use this command to insert tag entity in your database

$ php bin/console doctrine:schema:update -f

Usage

Tags fields in entity

namespace AppBundle\Entity;

use Coosos\TagBundle\Model\Taggable\TaggableTrait;

class Actuality {

    use TaggableTrait;

}

Form type

To create a field for tags, you must use a field type provided by the bundle

use Coosos\TagBundle\Form\Type\TagsType;
...
$builder->add("tags", TagsType::class);

Options

Configuration list
Config name Default value Values Description
coosos_tag_auto_complete true true | false If you want to use auto completion
coosos_tag_persist_new true true | false If you want the tags not exist is created
coosos_tag_category "default" string If you want to separate tags in different categories
Usage
$builder->add("tags", TagsType::class, [
    ...,
    "coosos_tag_auto_complete"  => false,
    "coosos_tag_persist_new"    => false,
    "coosos_tag_category"       => "House"
]);

Routing

You must include the route to the bundle controller

# app/config/routing.yml

tag:
    resource: "@CoososTagBundle/Controller/"
    type: annotation

Form theme

You must have jQuery tagEditor included in your project

twig:
    form_themes:
        - "CoososTagBundle:Form:fields.html.twig"
Auto complete

The auto completion uses the library jQuery UI Autocomplete

tagbundle's People

Contributors

coosos avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.