Add a new Script Feature

@api
@param ScriptFeature $scriptFeature Script Feature
@return static
198658
public function addScriptFeature(ScriptFeature $scriptFeature)
    {
        if (!in_array($scriptFeature, $this->scriptFeatures, true)) {
            array_push($this->scriptFeatures, $scriptFeature);
        }
        return $this;
    }
603776
static void addFeatureToScript(Node scriptNode, Feature feature) {
    checkState(scriptNode.isScript(), scriptNode);
    FeatureSet currentFeatures = getFeatureSetOfScript(scriptNode);
    FeatureSet newFeatures =
        currentFeatures != null
            ? currentFeatures.with(feature)
            : FeatureSet.BARE_MINIMUM.with(feature);
    scriptNode.putProp(Node.FEATURE_SET, newFeatures);
  }
557143
public function addMapInfoFeature($eventLabel = ScriptLabel::MOUSECLICK)
    {
        $mapInfo = new MapInfo($this, $eventLabel);
        $this->addScriptFeature($mapInfo);
        return $this;
    }
347978
protected function addFactory(&$script)
    {
        $builder = $this->getNewStubQueryInheritanceBuilder($this->getChild());
        $this->declareClassFromBuilder($builder, 'Child');
        $classname = $builder->getClassName();
        $script .= "
    /**
     * Returns a new " . $classname . " object.
     *
     * @param     string \$modelAlias The alias of a model in the query
     * @param     Criteria \$criteria Optional Criteria to build the query from
     *
     * @return " . $classname . "
     */
    public static function create(\$modelAlias = null, Criteria \$criteria = null)
    {
        if (\$criteria instanceof " . $classname . ") {
            return \$criteria;
        }
        \$query = new " . $classname . "();
        if (null !== \$modelAlias) {
            \$query->setModelAlias(\$modelAlias);
        }
        if (\$criteria instanceof Criteria) {
            \$query->mergeWith(\$criteria);
        }

        return \$query;
    }
";
    }
968115
public function add_js(){
    $args = \func_get_args();
    $has_path = false;
    foreach ( $args as $i => $a ){
      if ( $new_data = $this->retrieve_var($a) ){
        $this->js_data($new_data);
      }
      else if ( \is_string($a) ){
        $has_path = 1;
      }
      else if ( \is_array($a) ){
        $this->js_data($a);
      }
    }
    if ( !$has_path ){
      array_unshift($args, $this->path);
    }
    $args[] = 'js';
    if ( $r = $this->get_view(...$args) ){
      $this->add_script($r);
    }
    return $this;
  }
843818
public function addData($feature, $asArgument = false)
    {
        if ($asArgument) {
            if ($feature instanceof GeoJsonFeature) {
                $this->data->addFeature($feature);
            } else {
                $this->data->addFeature(new StaticFeature($feature));
            }
        } else {
            $this->addMethod('addData', array($feature));
        }

        return $this;
    }
316603
protected function addConstructorBody(&$script)
    {
        $table = $this->getTable();
        $script .= "
        if (null === \$dbName) {
            \$dbName = '" . $table->getDatabase()->getName() . "';
        }
        if (null === \$modelName) {
            \$modelName = '" . addslashes($this->getNewStubObjectBuilder($table)->getFullyQualifiedClassname()) . "';
        }
        parent::__construct(\$dbName, \$modelName, \$modelAlias);";
    }
1021484
protected function addDoCountJoinAllExcept(&$script)
    {
        $table = $this->getTable();
        $join_behavior = $this->getJoinBehavior();

        $fkeys = $table->getForeignKeys(); // this sep assignment is necessary otherwise sub-loops over
        // getForeignKeys() will cause this to only execute one time.
        foreach ($fkeys as $fk) {

            $tblFK = $table->getDatabase()->getTable($fk->getForeignTableName());

            $excludedTable = $table->getDatabase()->getTable($fk->getForeignTableName());

            $thisTableObjectBuilder = $this->getNewObjectBuilder($table);
            $excludedTableObjectBuilder = $this->getNewObjectBuilder($excludedTable);
            $excludedTablePeerBuilder = $this->getNewPeerBuilder($excludedTable);

            $excludedClassName = $excludedTableObjectBuilder->getObjectClassname();

            $script .= "

    /**
     * Returns the number of rows matching criteria, joining the related " . $thisTableObjectBuilder->getFKPhpNameAffix($fk, $plural = false) . " table
     *
     * @param      Criteria \$criteria
     * @param      boolean \$distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
     * @param      PropelPDO \$con
     * @param      String    \$join_behavior the type of joins to use, defaults to $join_behavior
     * @return int Number of matching rows.
     */
    public static function doCountJoinAllExcept" . $thisTableObjectBuilder->getFKPhpNameAffix($fk, $plural = false) . "(Criteria \$criteria, \$distinct = false, PropelPDO \$con = null, \$join_behavior = $join_behavior)
    {
        // we're going to modify criteria, so copy it first
        \$criteria = clone \$criteria;

        // We need to set the primary table name, since in the case that there are no WHERE columns
        // it will be impossible for the BasePeer::createSelectSql() method to determine which
        // tables go into the FROM clause.
        \$criteria->setPrimaryTableName(" . $this->getPeerClassname() . "::TABLE_NAME);

        if (\$distinct && !in_array(Criteria::DISTINCT, \$criteria->getSelectModifiers())) {
            \$criteria->setDistinct();
        }

        if (!\$criteria->hasSelectClause()) {
            " . $this->getPeerClassname() . "::addSelectColumns(\$criteria);
        }

        \$criteria->clearOrderByColumns(); // ORDER BY should not affect count

        // Set the correct dbName
        \$criteria->setDbName(" . $this->getPeerClassname() . "::DATABASE_NAME);

        if (\$con === null) {
            \$con = Propel::getConnection(" . $this->getPeerClassname() . "::DATABASE_NAME, Propel::CONNECTION_READ);
        }
    ";

            foreach ($table->getForeignKeys() as $subfk) {
                // want to cover this case, but the code is not there yet.
                if ($subfk->getForeignTableName() != $table->getName()) {
                    $joinTable = $table->getDatabase()->getTable($subfk->getForeignTableName());
                    $joinedTablePeerBuilder = $this->getNewPeerBuilder($joinTable);
                    $joinClassName = $joinedTablePeerBuilder->getObjectClassname();

                    if ($joinClassName != $excludedClassName) {
                        $script .= $this->addCriteriaJoin($subfk, $table, $joinTable, $joinedTablePeerBuilder);
                    }
                }
            } // foreach fkeys

            // apply behaviors
            $this->applyBehaviorModifier('preSelect', $script);

            $script .= "
        \$stmt = " . $this->basePeerClassname . "::doCount(\$criteria, \$con);

        if (\$row = \$stmt->fetch(PDO::FETCH_NUM)) {
            \$count = (int) \$row[0];
        } else {
            \$count = 0; // no rows returned; we infer that means 0 matches.
        }
        \$stmt->closeCursor();

        return \$count;
    }
";
        } // foreach fk

    }
344183
public function setFeatureAvId($v)
    {
        if ($v !== null) {
            $v = (int) $v;
        }

        if ($this->feature_av_id !== $v) {
            $this->feature_av_id = $v;
            $this->modifiedColumns[FeatureTypeAvMetaTableMap::FEATURE_AV_ID] = true;
        }

        if ($this->aFeatureAv !== null && $this->aFeatureAv->getId() !== $v) {
            $this->aFeatureAv = null;
        }


        return $this;
    }
237329
public function prepare(Script $script)
    {
        $script->addScriptFunction("buttonscript", $this->getScriptFunction());
        $script->addCustomScriptLabel(ScriptLabel::MouseClick, $this->getScriptMouseClick());
        $script->addCustomScriptLabel(ScriptLabel::MouseOver, <<<EOL
               if (Event.Control.Parent.HasClass("uiButton")) {                 
                  (Event.Control.Parent as CMlFrame).RelativeScale=1.1;
               }
EOL
        );

        $script->addCustomScriptLabel(ScriptLabel::MouseOut, <<<EOL
               if (Event.Control.Parent.HasClass("uiButton")) {                  
                  (Event.Control.Parent as CMlFrame).RelativeScale= 1.; 
               }
EOL
        );
    }
1016401
public function getScriptFeatures()
    {
        $features = [];
        if ($this->parentFrame instanceof ScriptFeatureable) {
            $features[] = $this->parentFrame->getScriptFeatures();
        }
        $features[] = $this;

        return ScriptFeature::collect($features);
    }
41512
public function getScriptFeatures()
    {
        $features = [];
        foreach ($this->elements as $element) {
            if ($element instanceof ScriptFeatureable) {
                $features[] = $element->getScriptFeatures();
            }
        }

        return ScriptFeature::collect($features);
    }
974713
public static function collect()
    {
        $params         = func_get_args();
        $scriptFeatures = array();
        foreach ($params as $object) {
            if ($object instanceof ScriptFeature) {
                $scriptFeatures = static::addScriptFeature($scriptFeatures, $object);
            } else if ($object instanceof ScriptFeatureable) {
                $scriptFeatures = static::addScriptFeature($scriptFeatures, $object->getScriptFeatures());
            } else if (is_array($object)) {
                foreach ($object as $subObject) {
                    $scriptFeatures = static::addScriptFeature($scriptFeatures, static::collect($subObject));
                }
            }
        }
        return $scriptFeatures;
    }
1082687
private function addAjaxPropertyForEditAll()
    {
        $inputProvider = $this->getEnvironment()->getInputProvider();

        if (('select' !== $inputProvider->getParameter('act'))
            && ('edit' !== $inputProvider->getParameter('select'))
            && ('edit' !== $inputProvider->getParameter('mode'))
        ) {
            return;
        }

        $originalProperty = $this->findOriginalPropertyByModelId($inputProvider->getValue('name'));
        if (null === $originalProperty) {
            return;
        }

        $propertiesDefinition = $this->getEnvironment()->getDataDefinition()->getPropertiesDefinition();

        $propertyClass = \get_class($originalProperty);

        $property = new $propertyClass($inputProvider->getValue('name'));
        $property->setLabel($originalProperty->getLabel());
        $property->setDescription($originalProperty->getDescription());
        $property->setDefaultValue($originalProperty->getDefaultValue());
        $property->setExcluded($originalProperty->isExcluded());
        $property->setSearchable($originalProperty->isSearchable());
        $property->setFilterable($originalProperty->isFilterable());
        $property->setWidgetType($originalProperty->getWidgetType());
        $property->setExplanation($originalProperty->getExplanation());
        $property->setExtra($originalProperty->getExtra());

        $propertiesDefinition->addProperty($property);
    }
1221188
protected function addAttributes(&$script)
    {
        $table = $this->getTable();

        $script .= "
";

        $script .= $this->renderTemplate('baseObjectAttributes');

        if (!$table->isAlias()) {
            $this->addColumnAttributes($script);
        }

        foreach ($table->getForeignKeys() as $fk) {
            $this->addFKAttributes($script, $fk);
        }

        foreach ($table->getReferrers() as $refFK) {
            $this->addRefFKAttributes($script, $refFK);
        }

        // many-to-many relationships
        foreach ($table->getCrossFks() as $crossFKs) {
            $this->addCrossFKAttributes($script, $crossFKs);
        }

        $this->addAlreadyInSaveAttribute($script);

        // apply behaviors
        $this->applyBehaviorModifier('objectAttributes', $script, "    ");
    }
498512
public function createScript()
    {
        if ($this->script) {
            return $this->script;
        }
        $script = new Script();
        $this->setScript($script);
        return $this->script;
    }
321788
public function addScript(string $name, AbstractScript $script): self
    {
        if (!\strlen($name)) {
            throw new InvalidException('The name of a Script is required and must be a string');
        }
        $this->setParam($name, $script);

        return $this;
    }