title: OctoberCMS: How to use a component's functions without knowing the component's name
body: <p>In OctoberCMS, I would like to change a page process simply by attaching a different plugin component. </p>
  
  <p>I have a plugin component (<code>makeform</code>) which inserts a form (defined in a database table).<br>
  Clicking the form's <code>submit</code> button calls <code>onSubmit()</code> which calls <code>process()</code>.<br>
  <code>process()</code> is a function defined in another plugin component. </p>
  
  <p><em>i)</em> Can I call <code>process()</code> from within <code>makeform</code> without knowing the name of the other plugin or its component? That is, without having to <code>use 'Acme\Plugin\Components\ProcessForm', 'processForm';</code> </p>
  
  <p><em>ii)</em> Alternatively, can I programmatically discover the name of the other attached component and it's plugin, and then somehow specify it's <code>process()</code> function? </p>
  
  <p><em>iii)</em> Or is it a case of using a static <code>properties</code> dropdown to choose which process, and then adding the component dynamically. Always assuming I can <code>$this-&gt;addComponent('Acme\Plugin\Components\ProcessForm', 'processForm');</code> beyond <code>init()</code>.  </p>
  
  <hr>
  
  <p><strong>Edit: Experimentation</strong></p>
  
  <p>I was hoping to dynamically <code>addComponent()</code>.<br>
  Wherever I place it, in <code>init()</code> or elsewhere, I get the error:  </p>
  
  <blockquote>
    <p>Class name is not registered for the component "Acme\Plugin\Components\ProcessForm". Check the component plugin.</p>
  </blockquote>
  
  <p>Even if I'm not using one of it's classes.<br>
  Many online references to this error message, but not one that has helped me.  </p>
  
  <p><strong>Edit: Further explanation</strong></p>
  
  <p>A (hopefully) simplified explanation of what I'm trying to achieve.  </p>
  
  <p>In essence I imagine a page process consisting of a string of components.<br>
  Each component calls a function in the next component until the process ends.<br>
  The overall process can be modified simply by replacing components.<br>
  I am guessing the only way to connect components is by standardizing the function names. So this (probably?) requires components to belong to particular stages of the process, although it would be ideal if each of them can fit in at any stage (where appropriate).  </p>
  
  <p><a href="https://i.stack.imgur.com/p9viF.png" rel="nofollow noreferrer">illustration</a></p>