public function renderResourceButton($resource, $action = 'view', array $options = [], array $attributes = [])
    {
        if ($this->helper->isGranted($resource, $action)) {
            $options = array_merge($this->getButtonOptions($action), $options);

            $label = null;
            if (array_key_exists('label', $options)) {
                $label = $options['label'];
                unset($options['label']);
            } elseif (array_key_exists('short', $options)) {
                if ($options['short']) {
                    $label = 'ekyna_core.button.' . $action;
                }
                unset($options['short']);
            }
            if (null === $label) {
                $config = $this->helper->getRegistry()->findConfiguration($resource);
                $label = sprintf('%s.button.%s', $config->getId(), $action);
            }

            if (!array_key_exists('path', $options)) {
                $options['path'] = $this->helper->generateResourcePath($resource, $action);
            }
            if (!array_key_exists('type', $options)) {
                $options['type'] = 'link';
            }

            return $this->ui->renderButton(
                $label,
                $options,
                $attributes
            );
        }

        return '';
    }
public function renderResourceButton($resource, $action = 'view', array $options = [], array $attributes = [])
    {
        if ($this->helper->isGranted($resource, $action)) {
            $options = array_merge($this->getButtonOptions($action), $options);

            $label = null;
            if (array_key_exists('label', $options)) {
                $label = $options['label'];
                unset($options['label']);
            } elseif (array_key_exists('short', $options)) {
                if ($options['short']) {
                    $label = 'ekyna_core.button.' . $action;
                }
                unset($options['short']);
            }
            if (null === $label) {
                $config = $this->helper->getRegistry()->findConfiguration($resource);
                $label = sprintf('%s.button.%s', $config->getId(), $action);
            }

            if (!array_key_exists('path', $options)) {
                $options['path'] = $this->helper->generateResourcePath($resource, $action);
            }
            if (!array_key_exists('type', $options)) {
                $options['type'] = 'link';
            }

            return $this->ui->renderButton(
                $label,
                $options,
                $attributes
            );
        }

        return '';
    }
public function renderResourceButton ( $ resource , $ action = 'view' , array $ options = [ ] , array $ attributes = [ ] ) { if ( $ this -> helper -> isGranted ( $ resource , $ action ) ) { $ options = array_merge ( $ this -> getButtonOptions ( $ action ) , $ options ) ; $ label = null ; if ( array_key_exists ( 'label' , $ options ) ) { $ label = $ options [ 'label' ] ; unset ( $ options [ 'label' ] ) ; } elseif ( array_key_exists ( 'short' , $ options ) ) { if ( $ options [ 'short' ] ) { $ label = 'ekyna_core.button.' . $ action ; } unset ( $ options [ 'short' ] ) ; } if ( null === $ label ) { $ config = $ this -> helper -> getRegistry ( ) -> findConfiguration ( $ resource ) ; $ label = sprintf ( '%s.button.%s' , $ config -> getId ( ) , $ action ) ; } if ( ! array_key_exists ( 'path' , $ options ) ) { $ options [ 'path' ] = $ this -> helper -> generateResourcePath ( $ resource , $ action ) ; } if ( ! array_key_exists ( 'type' , $ options ) ) { $ options [ 'type' ] = 'link' ; } return $ this -> ui -> renderButton ( $ label , $ options , $ attributes ) ; } return '' ; }
Renders a resource action button.

@param mixed $resource
@param string $action
@param array  $options
@param array  $attributes

@return string
Renders a resource action button .