Jump to content

Community

HeadStand

+Clients
  • Posts

    3,308
  • Joined

  • Last visited

  • Days Won

    14

Community Answers

  1. HeadStand's post in Form\Stack doesn't work with \Form\Member was marked as the answer   
    Stack doesn't work with any form field that requires javascript. You can't stack a node field either.
  2. HeadStand's post in How to generate invoice programmatically was marked as the answer   
    $package = \IPS\nexus\Package::load( 1 ); // use whatever product ID you need here $item = $package->createItemForCart( $package->price() ); // you can also use a custom price here with new \IPS\nexus\Money $invoice->addItem( $item );  
  3. HeadStand's post in Frontnavigation children was marked as the answer   
    The children method will generate a dropdown menu, not sub-menus. Ideally, you should be creating a FrontNavigation extension for each of the menu items you want, and then use the defaultFrontNavigation method in your Application.php file to put the menus where you want on installation. (Note: you will need to manually build your menu in the Menu Manager if you are in development mode OR if your app is already installed on the server.)
    For your own information...  sample of a working FrontNavigation extension with children.
    /** * Front Navigation Extension: Moderate */ class _Moderate extends \IPS\core\FrontNavigation\FrontNavigationAbstract { /** * Get Type Title which will display in the AdminCP Menu Manager * * @return string */ public static function typeTitle() { return \IPS\Member::loggedIn()->language()->addToStack( 'frontnavigation_proplibrary_moderate' ); } /** * Can access? * * @return bool */ public function canView() { // only admins can see this return \IPS\Member::loggedIn()->isAdmin(); } /** * Get Title * * @return string */ public function title() { if( isset( $this->configuration['action'] ) && $this->configuration['action'] ) { return \IPS\Member::loggedIn()->language()->addToStack( 'module__proplibrary_moderate_' . $this->configuration['action'] ); } return \IPS\Member::loggedIn()->language()->addToStack( 'frontnavigation_proplibrary_moderate' ); } /** * Get Link * * @return \IPS\Http\Url */ public function link() { $key = ( isset( $this->configuration['action'] ) && $this->configuration['action'] ) ? $this->configuration['action'] : 'authors'; return \IPS\Http\Url::internal( "app=proplibrary&module=moderate&controller={$key}" ); } /** * Is Active? * * @return bool */ public function active() { return \IPS\Dispatcher::i()->application->directory === 'proplibrary' && \IPS\Dispatcher::i()->module && \IPS\Dispatcher::i()->module->key == 'moderate'; } /** * Children * * @param bool $noStore If true, will skip datastore and get from DB (used for ACP preview) * @return array */ public function children( $noStore=FALSE ) { if( isset( $this->configuration['action'] ) && $this->configuration['action'] ) { return array(); } return array( new \IPS\proplibrary\extensions\core\FrontNavigation\Moderate( array( 'action' => 'authors', ), 0, '*' ), new \IPS\proplibrary\extensions\core\FrontNavigation\Moderate( array( 'action' => 'roots' ), 0, '*' ), new \IPS\proplibrary\extensions\core\FrontNavigation\Moderate( array( 'action' => 'links' ),0, '*' ), new \IPS\proplibrary\extensions\core\FrontNavigation\Moderate( array( 'action' => 'drafts' ), 0, '*' ) ); } }  
  4. HeadStand's post in Multi container or multi tags with permissions? was marked as the answer   
    You can't have tags without a category. 
  5. HeadStand's post in Custom ACP Menu Tab was marked as the answer   
    Feeling incredibly stupid right now. My Application::canAccess method had a permission check in there to check group permissions. I added
    if( \IPS\Dispatcher::hasInstance() && \IPS\Dispatcher::i()->controllerLocation == 'admin' ) { return true; } and now it works. ** facepalm **
  6. HeadStand's post in disable/enable plugin for settings changes to take effect was marked as the answer   
    Try changing the code to the following:
    $form->saveAsSettings( $values ); Also, the options you're passing in are incorrect for those form field types. app, key, and autoSaveKey are for Editor type or Translatable only.
  7. HeadStand's post in \IPS\Helpers\Chart\Dynamic ajax call issue was marked as the answer   
    The Dynamic charts, if I recall correctly, were built into the ACP and are not available by default on the front end. In order to get this working you need to include the admin JS libraries in your controller, like this:
    \IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'admin.js', 'global' ) ); You also should be sending back the chart (and only the chart) when the call is ajax, like this:
    if( \IPS\Request::i()->isAjax() ) { \IPS\Output::i()->output = (string)$chart; return; }  
  8. HeadStand's post in Adding javascript resources was marked as the answer   
    All the posts above are almost right, but not quite.
    Directory structure MUST be as follows:
    dev -> js -> front -> controllers  -> controllername -> file.
    Additionally, your JS MUST be named ips.controllername.filename.js.
    So for example, if you're trying to load your custom js, it would be
    dev -> js -> front -> controllers -> websocket -> ips.websocket.custom.js
    The code to call it would be
    \IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'front_websocket.js', 'botuserpanel', 'front' ) ); You must also make sure that the JS above is actually an IPS JS controller and not a 3rd party script. That means it should have something like
    ips.controller.register( 'botuserpanel.front.websocket.custom' You would also need to load that controller somewhere on the form, either by attaching it to an HTML element with data-controller='botuserpanel.front.websocket.custom' OR by adding it to the global controllers from inside your PHP controller.
    \IPS\Output::i()->globalControllers[] = 'botuserpanel.front.websocket.custom'; HOWEVER. If your JS does NOT follow IPS standards, and it is NOT an IPS controller, it does not belong in your dev/js folder at all. Instead it belongs in your app's interface folder, and you would load it with
    \IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'custom.js', 'botuserpanel', 'interface' ) );  
  9. HeadStand's post in Application settings was marked as the answer   
    As for settings, they already are in a separate table - core_sys_conf_settings. You can look up a setting by conf_key.
  10. HeadStand's post in Custom Embeds was marked as the answer   
    Your content item must implement \IPS\Content\Embeddable.
    That alone will make your content embeddable from the editor. If you want to customize the layout of the embedded content, you can add the following 2 methods to your class:
    /** * Get content for embed * * @param array $params Additional parameters to add to URL * @return string */ public function embedContent( $params ) { return \IPS\Theme::i()->getTemplate( 'global', 'core' )->embedItem( $this, $this->url()->setQueryString( $params ), $this->embedImage() ); } /** * Get image for embed * * @return \IPS\File|NULL */ public function embedImage() { return NULL; } The only one you would really need is embedContent, though.
  11. HeadStand's post in Issue when I have several Member fields on page was marked as the answer   
    You should use the property data-ipsDialog-forceReload=true. In your rowButtons function, this would be included in the data array, for example:
    data => array( 'ipsDialog' => '', 'ipsDialog-forceReload' => true )  
  12. HeadStand's post in How to disable "More" dropdown in NavBar? was marked as the answer   
    That won't work. The more menu will still be created, you just won't see it.
    The only way that I know of is to write a mixin on core.front.core.navBar and to work around _mushAllMenus (I think that's the function name).
    But more on topic for this forum: can we make it a little easier to disable this? I have had multiple clients ask for the more menu to be removed.
×
×
  • Create New...

Important Information

We use technologies, such as cookies, to customise content and advertising, to provide social media features and to analyse traffic to the site. We also share information about your use of our site with our trusted social media, advertising and analytics partners. See more about cookies and our Privacy Policy