array("default" => ""), "show_homepage" => array("default" => 0), "show_page" => array("default" => 0), "show_post" => array("default" => 0), "show_archive" => array("default" => 0), "placement" => array("default" => "after"), ); function __construct() { $this->fields["name"]["default"] = __("New Collection","maxbuttons"); } function parseCSS($css, $args) { $css["maxcollection"]["normal"]["display"] = "inline-block"; $css["maxcollection"]["normal"]["z-index"] = "9999"; switch($this->data["placement"]) { case "static-left": $css["maxcollection"]["normal"]["position"] = "fixed"; $css["maxcollection"]["normal"]["left"] = "0"; // these as string otherwise css compiler doens't like it $css["maxcollection"]["normal"]["top"] = "0"; break; case "static-right": $css["maxcollection"]["normal"]["position"] = "fixed"; $css["maxcollection"]["normal"]["right"] = "0"; $css["maxcollection"]["normal"]["top"] = "0"; break; case "static-top": $css["maxcollection"]["normal"]["position"] = "fixed"; $css["maxcollection"]["normal"]["left"] = "0"; $css["maxcollection"]["normal"]["top"] = "0"; break; case "static-bottom": $css["maxcollection"]["normal"]["position"] = "fixed"; $css["maxcollection"]["normal"]["left"] = "0"; $css["maxcollection"]["normal"]["bottom"] = "0"; break; } if ($args["preview"] == true) { if (isset($css["maxcollection"]["normal"]["position"]) && $css["maxcollection"]["normal"]["position"] == "fixed") { $css["maxcollection"]["normal"]["position"]= "absolute"; } } //$css["maxcollection"]["normal"]["background-color"] = "#fff"; return $css; } public function map_fields($map) { $map = parent::map_fields($map); $map["collection_name"]["func"] = "updateCollectionName"; $map["placement"]["func"] = "updatePlacement"; return $map; } function save_fields($data, $post) { $data = parent::save_fields($data, $post); $data["collection_name"] = $data[$this->blockname]["name"]; // save as a global meta for searching $data["collection_type"] = $this->collection->getType(); if ($data[$this->blockname]["show_homepage"] == 1) { $data["show_homepage"] = $data[$this->blockname]["placement"]; } if ($data[$this->blockname]["show_page"] == 1) { $data["show_page"] = $data[$this->blockname]["placement"]; } if ($data[$this->blockname]["show_post"] == 1) { $data["show_post"] = $data[$this->blockname]["placement"]; } if ($data[$this->blockname]["show_archive"] == 1) { $data["show_archive"] = $data[$this->blockname]["placement"]; } return $data; } function admin_fields() { extract($this->data); // admin data $placement_options = array( "after" => __("After","maxbuttons"), "before" => __("Before","maxbuttons"), "after-before" => __("Before + After (both)", "maxbuttons"), "static-left" => __("Static left","maxbuttons"), "static-right" => __("Static right","maxbuttons"), "static-top" => __("Static top","maxbuttons"), "static-bottom" => __("Static bottom","maxbuttons"), ); ?>