Add a new provider (triggered by the ExternalContentAdmin_left template)

@return unknown_type
163970
public function addprovider() {
		// Providers are ALWAYS at the root
		$parent = 0;

		$name = (isset($_REQUEST['Name'])) ? basename($_REQUEST['Name']) : _t('ExternalContent.NEWCONNECTOR', "New Connector");

		$type = $_REQUEST['ProviderType'];
		$providerClasses = ClassInfo::subclassesFor(self::$tree_class);

		if (!in_array($type, $providerClasses)) {
			throw new Exception("Invalid connector type");
		}

		$parentObj = null;

		// Create object
		$record = new $type();
		$record->ParentID = $parent;
		$record->Name = $record->Title = $name;

		// if (isset($_REQUEST['returnID'])) {
		// 	return $p->ID;
		// } else {
		// 	return $this->returnItemToUser($p);
		// }

		try {
			$record->write();
		} catch(ValidationException $ex) {
			$form->sessionMessage($ex->getResult()->message(), 'bad');
			return $this->getResponseNegotiator()->respond($this->request);
		}

		singleton('CMSPageEditController')->setCurrentPageID($record->ID);

		Session::set(
			"FormInfo.Form_EditForm.formError.message",
			sprintf(_t('ExternalContent.SourceAdded', 'Successfully created %s'), $type)
		);
		Session::set("FormInfo.Form_EditForm.formError.type", 'good');

		$msg = "New " . FormField::name_to_label($type) . " created";
		$this->response->addHeader('X-Status', rawurlencode(_t('ExternalContent.PROVIDERADDED', $msg)));
		return $this->getResponseNegotiator()->respond($this->request);
	}
1216442
public static void registerExternalConfigLoader(ExternalConfigLoader configLoader) {
        wLock.lock();
        try {
            CONFIG_LOADERS.add(configLoader);
            Collections.sort(CONFIG_LOADERS, new OrderedComparator<ExternalConfigLoader>());
        } finally {
            wLock.unlock();
        }
    }
113075
public function add(Provider $provider)
    {
        $provider->setApplication($this->app);
        $providerName = get_class($provider);
        if (!isset($this->providers[$providerName])) {
            $this->providers[$providerName] = $provider;
        }
    }
587812
public function add()
    {
        $post = $this->Posts->newEntity();

        if ($this->request->is('post')) {
            //Only admins and managers can add posts on behalf of other users
            if (!$this->Auth->isGroup(['admin', 'manager'])) {
                $this->request = $this->request->withData('user_id', $this->Auth->user('id'));
            }

            $post = $this->Posts->patchEntity($post, $this->request->getData());

            if ($this->Posts->save($post)) {
                $this->Flash->success(I18N_OPERATION_OK);

                return $this->redirect(['action' => 'index']);
            }

            $this->Flash->error(I18N_OPERATION_NOT_OK);
        }

        $this->set(compact('post'));
    }
944989
protected function _addFormContextProvider()
    {
        $this->addContextProvider('form', function ($request, $data) {
            if ($data['entity'] instanceof Form) {
                return new FormContext($request, $data);
            }
        });
    }
99070
public function add()
    {
        $cmsTerm = $this->CmsTerm->newEntity();
        if ($this->request->is('post')) {
            $cmsTerm = $this->CmsTerm->patchEntity($cmsTerm, $this->request->data);
            if ($this->CmsTerm->save($cmsTerm)) {
                $this->Flash->success('The cms term has been saved.');
                return $this->redirect(['action' => 'index']);
            } else {
                $this->Flash->error('The cms term could not be saved. Please, try again.');
            }
        }
        $this->set(compact('cmsTerm'));
        $this->set('_serialize', ['cmsTerm']);
    }
841080
protected function bindSentryProvider()
    {
        $this->app->singleton('revisionable.userprovider', function ($app) {
            $field = $app['config']->get('revisionable.userfield');
            return new Adapters\Sentry($app['sentry'], $field);
        });
    }
672472
public <T> RestBuilder addProvider(Class<T> clazz, Class<? extends ContextProvider<T>> provider) {

		Assert.notNull(clazz, "Missing provided class type!");
		Assert.notNull(provider, "Missing context provider!");
		registeredProviders.put(clazz, provider);
		return this;
	}
1024269
public static function add_entry_returns() {
        return new external_single_structure(
            array(
                'newentryid' => new external_value(PARAM_INT, 'True new created entry id. 0 if the entry was not created.'),
                'generalnotifications' => new external_multiple_structure(
                    new external_value(PARAM_RAW, 'General notifications')
                ),
                'fieldnotifications' => new external_multiple_structure(
                    new external_single_structure(
                        array(
                            'fieldname' => new external_value(PARAM_TEXT, 'The field name.'),
                            'notification' => new external_value(PARAM_RAW, 'The notification for the field.'),
                        )
                    )
                ),
                'warnings' => new external_warnings()
            )
        );
    }
751163
def add_default(self, ext, content_type):
        
        return self._add_default(extension=ext, contentType=content_type)
513440
public static void insertProviderAt(Provider newProvider, int slot) {
        Provider[] provider_list = Security.getProviders();
        if (null == provider_list || 0 == provider_list.length) {
            return;
        }

        // add the new provider to the new list at the correct slot #.
        Provider[] newList = new Provider[provider_list.length + 2];
        newList[slot] = newProvider;

        int newListIndex = 1;
        // add the rest of the providers
        for (int i = 0; i < provider_list.length; i++) {
            Provider currentProvider = provider_list[i];

            if (currentProvider != null && !currentProvider.getName().equals(newProvider.getName())) {
                // keep incrementing until we find the first available slot.
                while (newList[newListIndex] != null) {
                    newListIndex++;
                }

                newList[newListIndex] = currentProvider;
                newListIndex++;
            }
        }

        removeAllProviders();

        // add the rest of the providers to the list.
        for (int i = 0; i < newList.length; i++) {
            Provider currentProvider = newList[i];

            if (currentProvider != null) {
                int position = Security.insertProviderAt(currentProvider, (i + 1));
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                    Tr.debug(tc, currentProvider.getName() + " provider added at position " + position);
            }
        }
    }
90453
public function add($name)
    {
        $this->repository->setCurrentUser($this->repository->getUserService()->loadUser($this->adminID));
        $contentTypeService = $this->repository->getContentTypeService();

        $contentTypeGroupStruct = $contentTypeService->newContentTypeGroupCreateStruct($name);

        try {
            $contentTypeGroup = $contentTypeService->createContentTypeGroup($contentTypeGroupStruct);
            return $contentTypeGroup;
        } catch (UnauthorizedException $e) {
            throw new \RuntimeException($e->getMessage());
        } catch (InvalidArgumentException $e) {
            throw new \RuntimeException($e->getMessage());
        }
    }
292184
def add_default(self, ext, content_type):
        
        default = CT_Default.new(ext, content_type)
        self.append(default)
140172
public function add()
    {
        $ticket = $this->Tickets->newEntity();
        if ($this->request->is('post')) {
            $ticket = $this->Tickets->patchEntity($ticket, $this->request->data);
            if ($this->Tickets->save($ticket)) {
                $this->Flash->success(__('The ticket has been saved.'));

                return $this->redirect(['action' => 'index']);
            }
            $this->Flash->error(__('The ticket could not be saved. Please, try again.'));
        }
        $this->set(compact('ticket'));
        $this->set('_serialize', ['ticket']);
    }
279102
def add_template(self, tpl):
        
        tpl = self.index_template(tpl)
        self.templates[tpl.uuid] = tpl
103828
public function add()
    {
        /** @var \Qobo\Calendar\Model\Table\CalendarEventsTable $calendarEventsTable */
        $calendarEventsTable = TableRegistry::get('Qobo/Calendar.CalendarEvents');
        $calendar = $this->Calendars->newEntity();

        $eventTypes = $calendarEventsTable->getEventTypes(['user' => $this->Auth->user()]);

        if ($this->request->is('post')) {
            $data = $this->request->getData();
            $data = is_array($data) ? $data : [];
            if (!empty($data['event_types'])) {
                $data['event_types'] = json_encode($data['event_types']);
            }

            $calendar = $this->Calendars->patchEntity($calendar, $data);

            if ($this->Calendars->save($calendar)) {
                $this->Flash->success((string)__('The calendar has been saved.'));

                return $this->redirect(['action' => 'index']);
            }

            $this->Flash->error((string)__('The calendar could not be saved. Please, try again.'));
        }

        $this->set(compact('calendar', 'eventTypes'));
        $this->set('_serialize', 'calendar');
    }
986218
public function add($provider)
    {
        if (is_string($provider) && class_exists($provider)) {
            $provider = $this->resolveProvider($provider);
        }

        if ($provider instanceof ContainerAwareInterface) {
            $provider->setContainer($this->getContainer());
        }

        if ($provider instanceof ServiceProviderInterface) {
            foreach ($provider->provides() as $service) {
                $this->services[$service] = get_class($provider);
            }
            $this->providers[] = $provider;
            return $this;
        }

        throw new \InvalidArgumentException(
            'A service provider must be a fully qualified class name or instance ' .
            'of (\Nip\Container\ServiceProvider\ServiceProviderInterface)'
        );
    }