"Fossies" - the Fresh Open Source Software Archive

Member "papayacms-core-6.9.4/src/system/Papaya/Plugin/Editable/Content/Aggregation.php" (13 Dec 2019, 2228 Bytes) of package /linux/www/papayacms-core-6.9.4.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "Aggregation.php" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 6.8.0_vs_6.9.0.

    1 <?php
    2 /**
    3  * papaya CMS
    4  *
    5  * @copyright 2000-2018 by papayaCMS project - All rights reserved.
    6  * @link http://www.papaya-cms.com/
    7  * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU General Public License, version 2
    8  *
    9  *  You can redistribute and/or modify this script under the terms of the GNU General Public
   10  *  License (GPL) version 2, provided that the copyright and license notes, including these
   11  *  lines, remain unmodified. papaya is distributed in the hope that it will be useful, but
   12  *  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
   13  *  FOR A PARTICULAR PURPOSE.
   14  */
   15 namespace Papaya\Plugin\Editable\Content {
   16 
   17   use Papaya\Application\Access as ApplicationAccess;
   18   use Papaya\Plugin;
   19 
   20   /**
   21    * This a standard implementation for editable plugin content. It
   22    * makes implements the \Papaya\Plugin\Editable interface and
   23    * expects an implementation of the abstract method "createEditor".
   24    *
   25    * The method needs to return a \Papaya\Plugin\Editor instance.
   26    *
   27    * @package Papaya-Library
   28    * @subpackage Plugins
   29    */
   30   trait Aggregation {
   31 
   32     use ApplicationAccess\Aggregation;
   33 
   34     /**
   35      * @var Plugin\Editable\Content
   36      */
   37     private $_content;
   38 
   39     /**
   40      * The content is an {@see ArrayObject} child class containing the stored data.
   41      *
   42      * @param Plugin\Editable\Content $content
   43      *
   44      * @return Plugin\Editable\Content
   45      * @see \Papaya\Plugin\Editable::content()
   46      *
   47      */
   48     public function content(Plugin\Editable\Content $content = NULL) {
   49       if (NULL !== $content) {
   50         $this->_content = $content;
   51       } elseif (NULL === $this->_content) {
   52         $this->_content = new Plugin\Editable\Content();
   53         $this->_content->callbacks()->onCreateEditor = function (
   54           /** @noinspection PhpUnusedParameterInspection */
   55           $callbackContext, Plugin\Editable\Content $content
   56         ) {
   57           return $this->createEditor($content);
   58         };
   59       }
   60       return $this->_content;
   61     }
   62 
   63     /**
   64      * @param Plugin\Editable\Content $content
   65      *
   66      * @return \Papaya\Plugin\Editor
   67      */
   68     abstract public function createEditor(Plugin\Editable\Content $content);
   69   }
   70 }