Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Size: Mime:
<?php
namespace Stackable\DynamicContent\Sources;

class Current_Page {

    private $source_slug = 'current-page';

    function __construct() {
        add_filter( "stackable_dynamic_content/sources", array( $this, 'initialize_source' ), 1 );
        add_filter( "stackable_dynamic_content/$this->source_slug/fields", array( new Other_Posts(), 'initialize_fields' ), 1, 3 );
        add_filter( "stackable_dynamic_content/$this->source_slug/fields", array( new Other_Posts(), 'initialize_other_fields' ), 100, 3 );
        add_filter( "stackable_dynamic_content/$this->source_slug/entity", array( new Other_Posts(), 'get_entity' ), 1, 2 );
        add_filter( "stackable_dynamic_content/$this->source_slug/content", array( new Other_Posts(), 'get_content' ), 1, 2 );
        add_filter( "stackable_dynamic_content/$this->source_slug/content", array( new Other_Posts(), 'get_custom_field_content' ), 50, 2 );
    }

    /**
     * Function for registering the source.
     *
     * @param array previous sources object.
     * @return array newly generated $sources object.
     */
    function initialize_source( $sources ) {
        $sources[ $this->source_slug ] = array(
            'title' => __( 'Current Post', 'stackable' ),
        );

        return $sources;
    }
}

new Current_Page();