urAdminThemePlugin - 1.0.0

Admin generator with a lot of new options.

You are currently browsing
the website for symfony 1

Visit the Symfony2 website

« Back to the Plugins Home


Forgot your password?
Create an account



advanced search
Information Readme Releases Changelog Contribute
Show source | Show as Markdown

Please read Sample.yml to understand how generator.yml file for a module can be modified to be able to use this plugin.

Feature Provided: 1) Layout A layout node typically looks like this heading_name class: layout_class children:

layout_class can be any of 'Accordian' or 'Tabs' or 'Fields'. (Next releases will have more types.) children must be an array of field_names for layout_class=Fields. For other layout classes it must be another layout node. heading_name is used as the heading for Accordians or Tabs.

2) Credential: $helper->hasCredential($object, $user, $credentials) returns true/false based on current object, user and credentials array.

* If $object is not an object

  *  If $object is null; returns true

  *  else returns $object.

* else

  *  returns $helper->is{capitalized(RowLevelCredentialName)}($object, $user)

3) There are 2 different type of credentials provided here. A) Row Level Credentials

* Starts with _. for ex: _owner

* helper class has to define a function which returns true/false depending on the user crednetials.
  The prototype of the function looks like this for credential= _owner. (Note the name is isOwner)
    function isOwner($object, $user){
    return $object->user_id === $user->getGuardUser()->id;
  $object is the object of this modle type.
  $user is current sf_user.

* If show action has rowLevelCredentials, then it is mandatory to define a function in helper that looks like following
  (Note the name is getCredentialQueryOwner for _owner)
function getCredentialQueryOwner($user){
    return array('%%alias%%.user_id=?', $user->getGuardUser()->id);
  $user is current sf_user
  notice the return value. its array(queryText, bindParmeters).
  %%alias%% will be replaced by query root table alias automatically.

* If a field has rowLevelCredentials, it will not be shows in filter form.

* Defult context credentials defined are-
  : show - show
  : edit - edit, form
  : new - new, form
  : index - list
  : filter - filter
  Can be overridden by passing it in the generator.yml file as context_credentials. Check in sample.yml.

B) Context Level Credentials

* Starts with ~. For ex: ~edit

* Can be set by calling $helper->setContextCredentials(array('form', 'new'));

* A context level credentials holds true If setContextCredentials has been called and passed as parameter the name of context credentials.

3) If display.fields is set, only these fields will be shown. If it is not set, all the fields for the model and the relationships will be shown on list page. 4) Field credentials have been divided into three parts A) showIf: [credentials_array]

* If credentials are held by current user for current object in current context, the field is shown. Else it is hidden.

b) setIf:

* If credentials are held by current user for current object in current context, the field is set. Else it is unset. Mainly useful for forms.
  If a field is supposed to be unset, it is not set in the form and can not be passed from the request.

c) editableIf:

* does not have any difference for non-form contexts. Field becomes read-only of the credential criteria is not fulfilled.