Ejemplo n.º 1
0
 /**
  * Get the correct field group factory for provided underlying post type of the field group.
  *
  * This should not be needed from outside the legacy code.
  *
  * @param string $group_post_type
  * @return Types_Field_Group_Factory
  * @throws InvalidArgumentException when the post type doesn't belong to any field group.
  * @since 2.2.4
  */
 public static function get_group_factory_by_post_type($group_post_type)
 {
     $domains = self::get_domains();
     foreach ($domains as $domain) {
         $factory = Types_Field_Group_Factory::get_factory_by_domain($domain);
         if ($factory->get_post_type() == $group_post_type) {
             return $factory;
         }
     }
     throw new InvalidArgumentException('Invalid field group post type.');
 }
Ejemplo n.º 2
0
 /**
  * Query field groups from a single domain.
  *
  * @param string $domain One of the valid field domains. Legacy "meta type" values will be also accepted.
  * @param array $query Query arguments for Types_Field_Group_Factory::query_groups().
  *
  * @return null|Types_Field_Group[] Array of field groups or null on error.
  * @since m2m
  */
 private function query_specific_domain($domain, $query)
 {
     // Make sure we have a valid domain string.
     $valid_domains = Types_Field_Utils::get_domains();
     if (!in_array($domain, $valid_domains)) {
         $domain = Types_Field_Utils::legacy_meta_type_to_domain($domain);
     }
     // Pass the group query to the proper factory class.
     try {
         $group_factory = Types_Field_Group_Factory::get_factory_by_domain($domain);
         $groups = $group_factory->query_groups($query);
     } catch (Exception $e) {
         // We don't care, it's a failure.
         return null;
     }
     return $groups;
 }
Ejemplo n.º 3
0
 protected function __construct()
 {
     parent::__construct();
     //add_action( 'wpcf_group_updated', array( $this, 'on_group_updated' ), 10, 2 );
 }