Urlenhancer

class Nos\Orm_Behaviour_Urlenhancer
Used for Nos\Orm\Model displayed in the front-office by an URL Enhancer.

Configuration

property Nos\Orm_Behaviour_Urlenhancer::$enhancers

Required. Array of enhancers ID which can generate an URL for the item.

Listed enhancers must define a getUrlEnhanced($params) method.

Methods

Nos\Orm_Behaviour_Urlenhancer::urls($params = array())
Parameters:
  • $params (array) –
    enhancer:Specify enhancer ID. Restricts the search to the specified enhancer.
Returns:

Associative array of all possibles URLs for this item

  • key : page_id::item_slug. item slug is the URL part generate by enhancer.
  • value : Absolute URL.

Nos\Orm_Behaviour_Urlenhancer::url($params = array())
Parameters:
  • $params (array) –

    See Orm_Behaviour_Urlenhancer::urls.

    canonical:If true, return canonical URL of item.
    preview:If true, return even unpublished URL of item.
Returns:

Absolute URL of item or null if item can’t be displayed in front.

Nos\Orm_Behaviour_Urlenhancer::url_canonical($params = array())
Parameters:
Returns:

Absolute canonical URL of item or null if item can’t be displayed in front.

Alias for ->url(array('canonical' => true)).

If the item is sharable, returns the URL set in the shared data (content nugget).

Nos\Orm_Behaviour_Urlenhancer::preview_url()
Returns:Absolute canonical URL of item, even if it’s not published, or null if item can’t be displayed in the front-office.

Alias for ->url_canonical(array('preview' => true)).

Nos\Orm_Behaviour_Urlenhancer::deleteCacheItem()

Delete the cache of the pages containing this item only (this will not delete the cache for the whole enhancer).

Nos\Orm_Behaviour_Urlenhancer::deleteCacheEnhancer()

Delete the cache of the pages containing an URL enhancer for the item. Warning: this will delete for all the enhancer, not only the pages containing the item.

Nos\Orm_Behaviour_Urlenhancer::htmlAnchor($attributes = array())
Parameters:
  • $attributes (array) –
    Array of attributes to be applied to the anchor tag.
    If key ‘href’ is set in $attributes parameter:
    • if is a string, used for href attribute
    • if is an array, used as argument of ->url() method

    If key ‘text’ is set in $attributes parameter, its value replace item title

Returns:

Returns an HTML anchor tag with, by default, item URL in href and item title in text.

Example

<?php
class Model_Monkey extends \Nos\Orm\Model
{
        protected static $_behaviours = array(
                'Nos\Orm_Behaviour_Urlenhancer' => array(
                        'enhancers' => array('noviusos_monkey'),
                ),
        );
}
Read the Docs v: elche
Versions
latest
stable
elche
dubrovka
chiba.2
chiba.1
Downloads
pdf
htmlzip
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.