Attach a taxonomy in order to add custom fields.

@param TaxonomyInterface $taxonomy
@param array             $options

@return TaxonomyField
512825
public function make(TaxonomyInterface $taxonomy, array $options = []): TaxonomyField
    {
        $this->taxonomy = $taxonomy;
        $this->options = $options;

        return $this;
    }
983742
public function add($name, $type = 'text', array $options = [], $modify = false)
    {
        if (!$name || trim($name) == '') {
            throw new \InvalidArgumentException(
                'Please provide valid field name for class ['. get_class($this) .']'
            );
        }

        if ($this->rebuilding && !$this->has($name)) {
            return $this;
        }

        $this->addField($this->makeField($name, $type, $options), $modify);

        return $this;
    }
1211588
private function get_field_definition( $type, $options = null ) {

		$definition = PodsForm::field_method( $type, 'schema', $options );

		return $this->do_hook( 'field_definition', $definition, $type, $options );
	}
400024
protected function _addIdAttribute($name, array &$options) {
        $names = array(
            $this->getName(),
            $name
        );
        $parent = $this;
        while ($parent = $parent->getParent()) {
            $name = $parent->getName();
            if (!is_null($name)) {
                array_unshift($names, $parent->getName());
            }
        }
        $name = implode('-', $names);
        // if the root form has no name, the id will start with "-"
        $name = ltrim($name, '-');
        $options['id'] = strtolower($name) . '-field';
    }
1317980
public function create($taxonomy)
    {
        if (!($taxonomy instanceof stdClass)) {
            $taxonomy = get_taxonomy($taxonomy);
        }

        return new Taxonomy($taxonomy, $this->termFactory);
    }
960001
public function setOptions(array $options): FieldTypeInterface
    {
        $this->validateOptions($options);
        $this->options = $this->parseOptions(array_merge(
            $this->getDefaultOptions(),
            $this->options,
            $options
        ));

        return $this;
    }
619918
public function registerTaxonomy()
    {
        if (!taxonomy_exists($this->name)) {
            // create options for the Taxonomy
            $options = $this->createOptions();

            // register the Taxonomy with WordPress
            register_taxonomy($this->name, null, $options);
        }
    }
914597
public function addOption(OptionInterface $option)
    {
        if (!$this->hasOption($option)) {
            $this->options->add($option);
        }

        return $this;
    }
871494
public function edit_custom_taxonomy() {

    if(!isset($_GET['custom_taxonomy_id']) ){
      $this->mf_redirect(null,null,array('message' => 'success'));
    }

    $custom_taxonomy = $this->get_custom_taxonomy($_GET['custom_taxonomy_id']);

    if( !$custom_taxonomy ){
      $this->mf_redirect(null,null,array('message' => 'error'));
    }
    $data = $this->fields_form();

    $post_types = array();
    if( isset($custom_taxonomy['post_types']) ){
      foreach($custom_taxonomy['post_types'] as $k => $v){
        array_push($post_types,$v);
      }
      $data['taxonomy']['post_type'] = $post_types;
    }
    // update fields
    $perm = array('core','option','label');
    foreach($custom_taxonomy as $key => $value){
      if( in_array($key,$perm) ){
        foreach($value as $id => $val){
          $data[$key][$id]['value'] = $val;
        }
      }
    }
    $this->form_custom_taxonomy($data);
  }
279283
public static function get_taxonomy_field( $taxonomy_term, $field = '' ) {
		if ( is_a( $taxonomy_term, 'WP_Term' ) ) {
			return self::get_field( $taxonomy_term, $field );
		} elseif ( is_array( $taxonomy_term ) && count( $taxonomy_term ) >= 2 ) {
			return self::get_field( "{$taxonomy_term[0]}_{$taxonomy_term[1]}", $field );
		}
		throw new \Exception( '$taxonomy_term must be either a term object or an array of [$taxonomy, $term_id]' );
	}
718548
public function new_custom_taxonomy($data){
    global $wpdb;

    // escape all the strings
    array_walk_recursive($data, array($this, 'escape_data'));

    $sql = $wpdb->prepare(
      "INSERT INTO " . MF_TABLE_CUSTOM_TAXONOMY .
      " (type, name, description, arguments, active)" .
      " values" .
      " (%s, %s, %s, %s, %d)",
      $data['core']['type'],
      $data['core']['name'],
      $data['core']['description'],
      serialize($data),
      1
    );

    $wpdb->query($sql);
    $custom_taxonomy_id = $wpdb->insert_id;
    return $custom_taxonomy_id;
  }
480186
protected function setupFieldOptions($name, &$options)
    {
        if (!$this->getName()) {
            return;
        }

        $options['real_name'] = $name;

        if (!isset($options['label'])) {
            $options['label'] = $this->formHelper->formatLabel($name);
        }
    }
1118265
public function attachFile($file, $options=[]) {
		$attachment = \Swift_Attachment::fromPath($file);
		if(isset($options['filename']))
			$attachment->setFilename($options['filename']);
		if(isset($options['mime']))
			$attachment->setContentType($options['mime']);
		return $this->attach($attachment);
	}
400425
private function add_relationships(Tax $taxonomy)
    {
        if (! empty($this->posttypes)) {
            foreach ($this->posttypes as $k => $v) {
                $taxonomy->posttype($v);
            }
        }
    }
1014655
protected function makeField($name, $type = 'text', array $options = [])
    {
        $this->setupFieldOptions($name, $options);

        $fieldName = $this->getFieldName($name);

        $fieldType = $this->getFieldType($type);

        $field = new $fieldType($fieldName, $type, $this, $options);

        $this->eventDispatcher->dispatch(new AfterFieldCreation($this, $field));

        return $field;
    }
1262645
public function bindTaxonomyMapper()
    {
        $this->app->bind(TaxonomyMapper::class, function (Application $app) {
            $api = $app->make(ApiClient::class);

            return new TaxonomyMapper($api);
        });
    }
363551
public function add($option)
    {
        if (is_array($option)) {
            $this->collection[] = new Option($option);
        } elseif (is_object($option) && $option instanceof Option) {
            $this->collection[] = $option;
        }

        return $this;
    }