コード例 #1
0
 /**
  * Constructor.
  *
  * @param   array  $config  Field declaration.
  * @param   array  $merge   Array of property should be merged.
  *
  * @return  void
  */
 public function __construct($config, $merge = array('attributes', 'choices'))
 {
     // Get all themes for mega menu
     $path = apply_filters('wr_megamenu_themes', WR_MEGAMENU_ROOT_PATH . 'themes');
     $files = WR_Megamenu_Helpers_Functions::get_theme_styles($path);
     $this->choices = $files;
     // Call parent method to do remaining initialization
     parent::__construct($config, $merge);
 }
コード例 #2
0
ファイル: post-type.php プロジェクト: webprese/dev.mgeonline
 /**
  * Constructor.
  *
  * @param   array  $config  Field declaration.
  * @param   array  $merge   Array of property should be merged.
  *
  * @return  void
  */
 public function __construct($config, $merge = array('attributes', 'choices'))
 {
     // Get all post types
     $post_types = get_post_types(array('public' => true), 'objects');
     // Prepare post types
     foreach ($post_types as $slug => $defines) {
         $post_types[$slug] = $defines->labels->name;
     }
     // Update choices
     $this->choices = $post_types;
     // Call parent method to do remaining initialization
     parent::__construct($config, $merge);
     // Prepare value
     if ('all' == $this->value) {
         $this->value = array_map('strlen', $this->choices);
     }
 }