PHP Class Devise\Pages\PageManager

Afficher le fichier Open project: devisephp/cms Class Usage Examples

Méthodes publiques

Свойство Type Description
$errors array Errors are kept in an array and can be used later if validation fails and we want to know why
$message string This is a message that we can store why the validation failed
$warnings [type] [$warnings description]

Protected Properties

Свойство Type Description
$FieldManager Devise\Pages\Fields\FieldManager FieldManager lets us manage the fields
$FieldsRepository Devise\Pages\Fields\FieldsRepository FieldsRepository returns information about fields
$Page Page DvsPage model to fetch database dvs_pages
$PageFields array ..
$PageVersionManager PageVersionManager PageVersionManager lets us manage versions of a page
$Validator Illuminate\Validation\Factory Validator is used to validate page rules

Méthodes publiques

Méthode Description
__construct ( DvsPage $Page, PageVersionManager $PageVersionManager, PageVersionsRepository $PageVersionsRepository, FieldsRepository $FieldsRepository, FieldManager $FieldManager, Framework $Framework, RoutesGenerator $RoutesGenerator, DvsLanguage $Language ) Construct a new page manager
copyPage ( integer $fromPageId, array $input ) : DvsPage Takes the input provided and runs the create method after stripping necessary fields.
createNewPage ( $input ) : boolean Validates and creates a page with the given input
destroyPage ( integer $id ) : boolean Destroys a page
markContentRequestedFieldsComplete ( $pageId ) : string Marks all page's fields with a "true" content_requested value as complete
toggleABTesting ( [type] $pageId, [type] $isEnabled ) : [type] [toggleABTesting description]
updatePage ( integer $id, array $input ) : boolean Validates and updates a page with the given input
updatePageVersionABTestingAmount ( [type] $pageVersionId, [type] $amount ) : [type] [updatePageVersionABTestingAmount description]
updatePageVersionDates ( integer $pageVersionId, array $input ) : void Updates the page version dates
updatePageVersionView ( [type] $pageVersionId, [type] $view ) : [type] Updates the page version view

Méthodes protégées

Méthode Description
cacheDeviseRoutes ( ) : [type] Cache the devise routes, and make sure to catch an exception. Exception thrown is likely due to serialization error caused by caching routes with closures in them
createPageFromInput ( array $input ) : DvsPage Creates a page from the given input data
findAvailableRoute ( string $suggestedRoute, $languageId ) : string This helper method keeps looking through suggested route names and adding a number onto the suggested route until it finds an available one that isn't taken in the database. We don't want route names to be the same ever as they should be unique so this helps us accomplish that.
isValidInputForNewPage ( [type] $input ) : boolean [isValidInputForNewPage description]
setTranslatedFromPageId ( $fromPage, array &$input ) : array This ensures that we are translating from the correct "parent" page.
setTranslatedFromRouteName ( $fromPage, array &$input ) Sets the route_name equal to the orignal page's route_name

Method Details

__construct() public méthode

Construct a new page manager
public __construct ( DvsPage $Page, PageVersionManager $PageVersionManager, PageVersionsRepository $PageVersionsRepository, FieldsRepository $FieldsRepository, FieldManager $FieldManager, Framework $Framework, RoutesGenerator $RoutesGenerator, DvsLanguage $Language )
$Page DvsPage
$PageVersionManager PageVersionManager
$PageVersionsRepository PageVersionsRepository
$FieldsRepository Devise\Pages\Fields\FieldsRepository
$FieldManager Devise\Pages\Fields\FieldManager
$Framework Devise\Support\Framework
$RoutesGenerator RoutesGenerator
$Language DvsLanguage

cacheDeviseRoutes() protected méthode

Cache the devise routes, and make sure to catch an exception. Exception thrown is likely due to serialization error caused by caching routes with closures in them
protected cacheDeviseRoutes ( ) : [type]
Résultat [type]

copyPage() public méthode

Takes the input provided and runs the create method after stripping necessary fields.
public copyPage ( integer $fromPageId, array $input ) : DvsPage
$fromPageId integer
$input array
Résultat DvsPage

createNewPage() public méthode

Validates and creates a page with the given input
public createNewPage ( $input ) : boolean
Résultat boolean

createPageFromInput() protected méthode

Creates a page from the given input data
protected createPageFromInput ( array $input ) : DvsPage
$input array
Résultat DvsPage

destroyPage() public méthode

Destroys a page
public destroyPage ( integer $id ) : boolean
$id integer
Résultat boolean

findAvailableRoute() protected méthode

This helper method keeps looking through suggested route names and adding a number onto the suggested route until it finds an available one that isn't taken in the database. We don't want route names to be the same ever as they should be unique so this helps us accomplish that.
protected findAvailableRoute ( string $suggestedRoute, $languageId ) : string
$suggestedRoute string
Résultat string

isValidInputForNewPage() protected méthode

[isValidInputForNewPage description]
protected isValidInputForNewPage ( [type] $input ) : boolean
$input [type]
Résultat boolean

markContentRequestedFieldsComplete() public méthode

Marks all page's fields with a "true" content_requested value as complete
public markContentRequestedFieldsComplete ( $pageId ) : string
Résultat string

setTranslatedFromPageId() protected méthode

This happens when a user creates a page and then copies that "parent" page to a "child" page. When the user tries to copy the "child" page to a "grandchild" page. We want the "grandchild" to be a "child" instead of a "grandchild". This keeps page nesting down to 1 level instead of nesting under many levels.
protected setTranslatedFromPageId ( $fromPage, array &$input ) : array
$input array
Résultat array

setTranslatedFromRouteName() protected méthode

Sets the route_name equal to the orignal page's route_name
protected setTranslatedFromRouteName ( $fromPage, array &$input )
$input array

toggleABTesting() public méthode

[toggleABTesting description]
public toggleABTesting ( [type] $pageId, [type] $isEnabled ) : [type]
$pageId [type]
$isEnabled [type]
Résultat [type]

updatePage() public méthode

Validates and updates a page with the given input
public updatePage ( integer $id, array $input ) : boolean
$id integer
$input array
Résultat boolean

updatePageVersionABTestingAmount() public méthode

[updatePageVersionABTestingAmount description]
public updatePageVersionABTestingAmount ( [type] $pageVersionId, [type] $amount ) : [type]
$pageVersionId [type]
$amount [type]
Résultat [type]

updatePageVersionDates() public méthode

Updates the page version dates
public updatePageVersionDates ( integer $pageVersionId, array $input ) : void
$pageVersionId integer
$input array
Résultat void

updatePageVersionView() public méthode

Updates the page version view
public updatePageVersionView ( [type] $pageVersionId, [type] $view ) : [type]
$pageVersionId [type]
$view [type]
Résultat [type]

Property Details

$FieldManager protected_oe property

FieldManager lets us manage the fields
protected FieldManager,Devise\Pages\Fields $FieldManager
Résultat Devise\Pages\Fields\FieldManager

$FieldsRepository protected_oe property

FieldsRepository returns information about fields
protected FieldsRepository,Devise\Pages\Fields $FieldsRepository
Résultat Devise\Pages\Fields\FieldsRepository

$Page protected_oe property

DvsPage model to fetch database dvs_pages
protected Page $Page
Résultat Page

$PageFields protected_oe static_oe property

..
protected static array $PageFields
Résultat array

$PageVersionManager protected_oe property

PageVersionManager lets us manage versions of a page
protected PageVersionManager,Devise\Pages $PageVersionManager
Résultat PageVersionManager

$Validator protected_oe property

Validator is used to validate page rules
protected Illuminate\Validation\Factory $Validator
Résultat Illuminate\Validation\Factory

$errors public_oe property

Errors are kept in an array and can be used later if validation fails and we want to know why
public array $errors
Résultat array

$message public_oe property

This is a message that we can store why the validation failed
public string $message
Résultat string

$warnings public_oe property

[$warnings description]
public [type] $warnings
Résultat [type]