Pimcore\Model\Document\Tag::admin PHP Method

admin() public method

public admin ( ) : string
return string
    public function admin()
    {
        // get configuration data for admin
        if (method_exists($this, "getDataEditmode")) {
            $data = $this->getDataEditmode();
        } else {
            $data = $this->getData();
        }
        $options = ["options" => $this->getOptions(), "data" => $data, "name" => $this->getName(), "id" => "pimcore_editable_" . $this->getName(), "type" => $this->getType(), "inherited" => $this->getInherited()];
        $options = @\Zend_Json::encode($options, false, ['enableJsonExprFinder' => true]);
        $class = "pimcore_editable pimcore_tag_" . $this->getType();
        if (array_key_exists("class", $this->getOptions())) {
            $class .= " " . $this->getOptions()["class"];
        }
        return '
            <script type="text/javascript">
                editableConfigurations.push(' . $options . ');
            </script>
            <div id="pimcore_editable_' . $this->getName() . '" class="' . $class . '"></div>
        ';
    }

Usage Example

Beispiel #1
0
 /**
  * @see Document\Tag\TagInterface::admin
  * @return string
  */
 public function admin()
 {
     $html = parent::admin();
     // get frontendcode for preview
     // put the video code inside the generic code
     $html = str_replace("</div>", $this->frontend() . "</div>", $html);
     return $html;
 }