2017 © Pedro Peláez
 

library breadcrumbs

Powerful and flexible component for building site breadcrumbs in Phalcon 2+.

image

phalcongelist/breadcrumbs

Powerful and flexible component for building site breadcrumbs in Phalcon 2+.

  • Saturday, December 24, 2016
  • by klay
  • Repository
  • 6 Watchers
  • 19 Stars
  • 2,292 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 7 Versions
  • 3 % Grown

The README.md

Phalcon Breadcrumbs ![Build Status][:travis-badge:]

Breadcrumbs Screenshot, (*1)

Phalcon Breadcrumbs is a powerful and flexible component for building site breadcrumbs. You can adapt it to your own needs or improve it if you want., (*2)

Please write us if you have any feedback., (*3)

Thanks!, (*4)

NOTE

The master branch will always contain the latest stable version. If you wish to check older versions or newer ones currently under development, please switch to the relevant branch/tag., (*5)

Getting Started

Requirements

To use this component, you need at least:, (*6)

NOTE: Support for legacy PHP versions (down to 7.0) is provided on a best-effort basis., (*7)

Installing

$ composer require sergeyklay/breadcrumbs

Define your breadcrumbs

We recommend registering it with your application's services for even easier use:, (*8)

setShared('breadcrumbs', function () {
    return new Breadcrumbs;
});
```

**Adding a crumb with a link:**

```php
breadcrumbs->add('Home', '/');
```

**Adding a crumb without a link (normally the last one):**

```php
breadcrumbs->add('User', null, ['linked' => false]);
```

**Output crumbs:**

Php Engine
```html

Volt Engine, (*9)

<ol class="breadcrumb">
  {{ breadcrumbs.output() }}
</ol>

Change crumb separator:, (*10)

<?php

$this->breadcrumbs->setSeparator(' &raquo; ');

Make The last element is always not a link:, (*11)

<?php

$this->breadcrumbs->setLastNotLinked(true);

Delete a crumb (by url):, (*12)

<?php

$this->breadcrumbs->remove('/admin/user/create');

// remove a crumb without an url
$this->breadcrumbs->remove(null);

Update an existing crumb:, (*13)

<?php

$this->breadcrumbs->update('/admin/user/remove', ['label' => '<strong class="red">Remove</strong>']);

Count crumbs:, (*14)

<?php

$this->breadcrumbs->count();

Sets rendering template:, (*15)

<?php

$this->breadcrumbs->setTemplate(
    '<li><a href="{{link}}">{{icon}}{{label}}</a></li>', // linked
    '<li class="active">{{icon}}{{label}}</li>',         // not linked
    '<i class="fa fa-dashboard"></i>'                    // first icon
);

Multi-language support:, (*16)

<?php

use Phalcon\Translate\Adapter\NativeArray as Translator;
use Phalcon\Breadcrumbs;

$messages = [
    'crumb-home'     => 'Home',
    'crumb-user'     => 'User',
    'crumb-settings' => 'Settings',
    'crumb-profile'  => 'Profile',
];

// Initialize the Translate adapter.
$di->setShared('translate', function () use ($messages) {
    return new Translator(['content' => $messages]);
});

// Initialize the Breadcrumbs component.
$di->setShared('breadcrumbs', function () {
    return new Breadcrumbs;
});

Errors logging:, (*17)

<?php

use Phalcon\Logger\Formatter\Line as FormatterLine;
use Phalcon\Logger\Adapter\File as FileLogger;
use Phalcon\Breadcrumbs;

/**
 * Initialize the Logger.
 *
 * @var $config array
 * @var $di \Phalcon\Di
 */
$di->setShared('logger', function ($filename = null, $format = null) use ($config) {
    $formatter = new FormatterLine($config->get('logger')->format, $config->get('logger')->date);
    $logger = new FileLogger($config->get('logger')->path . $config->get('logger')->filename);

    $logger->setFormatter($formatter);
    $logger->setLogLevel($config->get('logger')->logLevel);

    return $logger;
});

// Initialize the Breadcrumbs component.
$di->setShared('breadcrumbs', function () {
    return new Breadcrumbs;
});

Events

<?php

use Phalcon\Breadcrumbs;
use Phalcon\Events\Manager as EventsManager;

// Initialize the Events Manager.
$di->setShared('eventsManager', function () {
    return new EventsManager;
});

// Initialize the Breadcrumbs component.
$di->setShared('breadcrumbs', function () use ($di) {
    $manager = $di->getShared('eventsManager');
    $manager->attach('breadcrumbs', function ($event, $connection) {
        // We stop the event if it is cancelable
        if ($event->isCancelable()) {
            // Stop the event, so other listeners will not be notified about this
            $event->stop();
        }

        // Receiving the data from the event context
        print_r($event->getData());
    });

    $breadcrumbs = new Breadcrumbs;
    $breadcrumbs->setEventsManager($manager);

    return $breadcrumbs;
});

Available events:, (*18)

breadcrumbs:beforeAdd
breadcrumbs:afterAdd
breadcrumbs:beforeOutput
breadcrumbs:afterOutput
breadcrumbs:beforeTranslate
breadcrumbs:afterTranslate
breadcrumbs:beforeLogging
breadcrumbs:afterLogging
breadcrumbs:beforeRemove
breadcrumbs:afterRemove
breadcrumbs:beforeUpdate
breadcrumbs:afterUpdate
breadcrumbs:beforeSetTemplate
breadcrumbs:afterSetTemplate

Phalcon Breadcrumbs is open-sourced software licensed under the New BSD License. © Serghei Iakovlev, (*19)

The Versions

24/12 2016

1.2.x-dev

1.2.9999999.9999999-dev https://github.com/phalcongelist/breadcrumbs

Powerful and flexible component for building site breadcrumbs in Phalcon 2+.

  Sources   Download

BSD-3-Clause

The Requires

  • php >= 5.5
  • ext-phalcon >=2.0 <4.0

 

The Development Requires

phalcon breadcrumbs crumbs

20/12 2016

dev-master

9999999-dev https://github.com/phalcongelist/breadcrumbs

Powerful and flexible component for building site breadcrumbs in Phalcon 2+.

  Sources   Download

BSD-3-Clause

The Requires

  • php >= 5.5
  • ext-phalcon >=2.0 <4.0

 

The Development Requires

phalcon breadcrumbs crumbs

20/12 2016

v1.2.1

1.2.1.0 https://github.com/phalcongelist/breadcrumbs

Powerful and flexible component for building site breadcrumbs in Phalcon 2+.

  Sources   Download

BSD-3-Clause

The Requires

  • php >= 5.5
  • ext-phalcon >=2.0 <4.0

 

The Development Requires

phalcon breadcrumbs crumbs

26/03 2016

v1.2.0

1.2.0.0 https://github.com/phalcongelist/breadcrumbs

Powerful and flexible component for building site breadcrumbs in Phalcon 2+.

  Sources   Download

BSD-3-Clause

The Requires

  • php >= 5.4
  • ext-phalcon >=2.0

 

The Development Requires

phalcon breadcrumbs crumbs

12/03 2016

v1.1.1

1.1.1.0 https://github.com/phalcongelist/breadcrumbs

Powerful and flexible component for building site breadcrumbs in Phalcon 2+.

  Sources   Download

BSD-3-Clause

The Requires

  • php >= 5.4
  • ext-phalcon >=2.0

 

The Development Requires

phalcon breadcrumbs crumbs

21/02 2016

v1.1.0

1.1.0.0 https://github.com/phalcongelist/breadcrumbs

Powerful and flexible component for building site breadcrumbs in Phalcon 2+.

  Sources   Download

BSD-3-Clause

The Requires

  • php >= 5.4
  • ext-phalcon >=2.0

 

The Development Requires

phalcon breadcrumbs crumbs

21/02 2016

v1.0.0

1.0.0.0 https://github.com/phalcongelist/breadcrumbs

Powerful and flexible component for building site breadcrumbs in Phalcon 2+.

  Sources   Download

BSD-3-Clause

The Requires

  • php >= 5.4
  • ext-phalcon >=2.0

 

The Development Requires

phalcon breadcrumbs crumbs