public function addResourcePossibility(WordpressEntity $model)
    {
        $slug = null;

        if (property_exists($model, "routed") && is_array($model->routed) &&  array_key_exists("controller", $model->routed)) {
            $controllerName = $model->routed['controller'];
            $controllerObject = new $controllerName();
            $controller = $controllerObject->getShortName();
        } else {
            $controller = Controller::generateClassName($model->getShortName());
        }

        $i18n = Strata::i18n();
        if ($i18n->isLocalized()) {
            $currentLocale = $i18n->getCurrentLocale();
            if ($currentLocale && !$currentLocale->isDefault()) {
                $slugInfo = $model->extractConfig("i18n." . $currentLocale->getCode() . ".rewrite.slug");
                $slug = array_pop($slugInfo);

                if (!is_null($slug)) {
                    $this->automatedRoutes[] = array('*', "/$slug/page/[i:pageNumber]/?", "$controller#index");
                    $this->automatedRoutes[] = array('*', "/$slug/[:slug]/?", "$controller#show");
                    $this->automatedRoutes[] = array('*', "/$slug/?", "$controller#index");
                }
            }
        }

        $slugInfo = $model->extractConfig("rewrite.slug");
        $slug = array_pop($slugInfo);

        if (is_null($slug)) {
            $slug = $model->getWordpressKey();
        }

        $this->automatedRoutes[] = array('*', "/$slug/page/[i:pageNumber]/?", "$controller#index");
        $this->automatedRoutes[] = array('*', "/$slug/[:slug]/?", "$controller#show");
        $this->automatedRoutes[] = array('*', "/$slug/?", "$controller#index");
    }
public function addResourcePossibility(WordpressEntity $model)
    {
        $slug = null;

        if (property_exists($model, "routed") && is_array($model->routed) &&  array_key_exists("controller", $model->routed)) {
            $controllerName = $model->routed['controller'];
            $controllerObject = new $controllerName();
            $controller = $controllerObject->getShortName();
        } else {
            $controller = Controller::generateClassName($model->getShortName());
        }

        $i18n = Strata::i18n();
        if ($i18n->isLocalized()) {
            $currentLocale = $i18n->getCurrentLocale();
            if ($currentLocale && !$currentLocale->isDefault()) {
                $slugInfo = $model->extractConfig("i18n." . $currentLocale->getCode() . ".rewrite.slug");
                $slug = array_pop($slugInfo);

                if (!is_null($slug)) {
                    $this->automatedRoutes[] = array('*', "/$slug/page/[i:pageNumber]/?", "$controller#index");
                    $this->automatedRoutes[] = array('*', "/$slug/[:slug]/?", "$controller#show");
                    $this->automatedRoutes[] = array('*', "/$slug/?", "$controller#index");
                }
            }
        }

        $slugInfo = $model->extractConfig("rewrite.slug");
        $slug = array_pop($slugInfo);

        if (is_null($slug)) {
            $slug = $model->getWordpressKey();
        }

        $this->automatedRoutes[] = array('*', "/$slug/page/[i:pageNumber]/?", "$controller#index");
        $this->automatedRoutes[] = array('*', "/$slug/[:slug]/?", "$controller#show");
        $this->automatedRoutes[] = array('*', "/$slug/?", "$controller#index");
    }
public function addResourcePossibility ( WordpressEntity $ model ) { $ slug = null ; if ( property_exists ( $ model , "routed" ) && is_array ( $ model -> routed ) && array_key_exists ( "controller" , $ model -> routed ) ) { $ controllerName = $ model -> routed [ 'controller' ] ; $ controllerObject = new $ controllerName ( ) ; $ controller = $ controllerObject -> getShortName ( ) ; } else { $ controller = Controller :: generateClassName ( $ model -> getShortName ( ) ) ; } $ i18n = Strata :: i18n ( ) ; if ( $ i18n -> isLocalized ( ) ) { $ currentLocale = $ i18n -> getCurrentLocale ( ) ; if ( $ currentLocale && ! $ currentLocale -> isDefault ( ) ) { $ slugInfo = $ model -> extractConfig ( "i18n." . $ currentLocale -> getCode ( ) . ".rewrite.slug" ) ; $ slug = array_pop ( $ slugInfo ) ; if ( ! is_null ( $ slug ) ) { $ this -> automatedRoutes [ ] = array ( '*' , "/$slug/page/[i:pageNumber]/?" , "$controller#index" ) ; $ this -> automatedRoutes [ ] = array ( '*' , "/$slug/[:slug]/?" , "$controller#show" ) ; $ this -> automatedRoutes [ ] = array ( '*' , "/$slug/?" , "$controller#index" ) ; } } } $ slugInfo = $ model -> extractConfig ( "rewrite.slug" ) ; $ slug = array_pop ( $ slugInfo ) ; if ( is_null ( $ slug ) ) { $ slug = $ model -> getWordpressKey ( ) ; } $ this -> automatedRoutes [ ] = array ( '*' , "/$slug/page/[i:pageNumber]/?" , "$controller#index" ) ; $ this -> automatedRoutes [ ] = array ( '*' , "/$slug/[:slug]/?" , "$controller#show" ) ; $ this -> automatedRoutes [ ] = array ( '*' , "/$slug/?" , "$controller#index" ) ; }
Adds a resourced based route possibility based on a custom
post type or taxonomy.
@param WordpressEntity $model
Adds a resourced based route possibility based on a custom post type or taxonomy .