texts: How to create a view that lists all groups and their respective contents?

texts:
I have used organic groups to implement the 'group' & 'group content' functionality.

I have a group content type.
And, I have a group content content type.

How can I create a view that lists all groups' titles and their respective contents' titles clubbed together with that group?

For eg.

If,

Group 1 has 2 content types: C1 & C2,

Group 2 has 2 content types: C3, C4 & C5,

Group 3 has 2 content types: C6,

Group 4 has 2 content types: C7 & C8,

Then expected result is:

Group 1: C1, C2
Group 1: C3, C4 & C5
Group 1: C6
Group 1: C7, C8


texts: How to force rules configuration to load

texts:
There is a rule that comes with Commerce Paypal, commerce_payment_paypal_wpp, it implements an Action: "PayPal WPP - Credit Card", which provides an admin interface to configuring the PayPal WPP, with API Username, password, etc.   We've implemented our settings for this, as with other rules, as commerce_paypal_wpp.rules_defaults.inc.

The problem is that, in this case, commerce_paypal_wpp.rules_defaults.inc is not loaded for some reason when the rule is installed.  After installation, we have to log in, navigate to that admin form, open it and press save, no changes, just press save.

We tried without success:

function MODULE_default_rules_configuration_alter(&$configs) {
  $configs['commerce_payment_paypal_wpp']->active = TRUE;
  $rule = rules_config_load('commerce_payment_paypal_wpp');
  $rule->save;
}

What do we need to do in code that would do the work of clicking that save button?  This is the last obstacle to a zero-touch installation, would really like to get that in.  Any ideas?


texts:
Whenever I try to delete any content, be it custom or core, I am unable to do so. I get the following error:

  warning:%20array_flip%28%29:%20Can%20only%20flip%20STRING%20and%20INTEGER%20values!%20in%20DrupalDefaultEntityController->load%28%29%20%28line%20178%20of%20/opt/lampp/htdocs/includes/entity.inc%29.

  Recoverable fatal error: Object of class Message could not be
  converted to string in DatabaseStatementBase->execute() (line 2139 of
  /opt/lampp/htdocs/includes/database/database.inc).

What is this, and how can I delete the content be it a basic page or article etc


texts: How to insert html tag "id" in an image field in a view

texts:
I need to add id tag to an image which is a field of a view. Currently it seems only possible to add a class name.

 <img id="xxx" typeof="foaf:Image" ...


texts: How to define profile types per group type in the Group module?

texts:
I am working on a site where I am just starting to work with the Drupal 7 version of the Group module. The groups and roles stuff is fine but can I define a profile type per group type?

eg. Group Type "School" might have profiles Principal, Teacher, Student, Volunteer and Group Type "Church" might have profiles Pastor, Youth Worker, Member etc

So when someone signs up I want them to find their group (eg St John's Baptist) and then enter their profile type (eg Pastor).

Then I want to show specific content depending on their profile type. eg All Pastor's will have access to certain nodes.

Group profile types seems to be global so looking for a way to do this neatly.


texts: Is it possible to install new module without ftp in drupal 6?

texts:
I don't have the cpanel password of my hosting, I want to install new module through website. It's easy in D7, how can I do it in D6.

Note: if you suggest any module, I can't install that too through ftp and I don't know drush too.


texts: DrupalVM ubuntu 14.04 vagrant provision error 'packages cannot be authenticated'

texts:
I ran vagrant provision and I get this error:

at: apt-get install -y -qq software-properties-common python-software-properties

error message:
WARNING: The following packages cannot be authenticated!
python-software-properties

When I try run sudo apt-get update on the VM I get these errors.

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/trusty/InRelease
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/trusty-updates/InRelease
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/trusty-backports/InRelease
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/trusty/Release.gpg  Could not resolve 'us.archive.ubuntu.com'
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/trusty-updates/Release.gpg  Could not resolve 'us.archive.ubuntu.com'
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/trusty-backports/Release.gpg  Could not resolve 'us.archive.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.

Note that there is no InRelease file in these directories:

http://us.archive.ubuntu.com/ubuntu/dists/trusty/

http://old-releases.archive.ubuntu.com/ubuntu/dists/trusty/InRelease

I am using:

Host machine:
OS: Ubuntu 16.04 x86_64
vagrant: Vagrant 1.8.5

VM:
box 'geerlingguy/ubuntu1404' (v1.1.3) for provider: virtualbox

config.yml:

vagrant_hostname: iemp.local
vagrant_machine_name: iemp

vagrant_box: geerlingguy/ubuntu1404
php_version: "5.6"
drupal_major_version: 7
drush_version: "7.x"

php_packages:
  - php5
  - php5-apcu
  - php5-mcrypt
  - php5-cli
  - php5-common
  - php5-curl
  - php5-dev
  - php5-fpm
  - php5-gd
  - php5-sqlite
  - php-pear
  - libpcre3-dev
php_conf_paths:
  - /etc/php5/fpm
  - /etc/php5/apache2
  - /etc/php5/cli
php_extension_conf_paths:
  - /etc/php5/fpm/conf.d
  - /etc/php5/apache2/conf.d
  - /etc/php5/cli/conf.d
php_fpm_daemon: php5-fpm
php_fpm_conf_path: "/etc/php5/fpm"
php_fpm_pool_conf_path: "/etc/php5/fpm/pool.d/www.conf"
php_mysql_package: php5-mysql

build_makefile: false
build_composer: false
build_composer_project: false
install_site: false

vagrant_synced_folders:
  - local_path: ./
    destination: /var/www/drupalvm
    type: nfs
    create: true


texts: How can I send myself an email whenever a user views a Panels page?

texts:
I have a page that users rarely visit but I would like to send myself an e-mail to the effect of "UID 555 visited the special page."

My site has several hundred pages but I only want to send an e-mail for this specific page.

I thought of using rules (event: when content is viewed), but

this event has to be evaluated on every page hit
it doesn't seem to trigger when the page is embedded within a panel

So, I was wondering if there is some way to easily send myself an email with the UID whenever a user visits a specific panel page.


texts: Views strips/merges unlimited values/fields of same field into one

texts:
I have a content type and a Text field 'Achievements'. Now it is set to Unlimited so every time when creating that content I enter an achievement per field. So then I have a nice list of achievements listed in separate divs where I can apply CSS and etc.

I made a view to list those content types including achievements fields and Views merges in all achievements into one view-field and makes a total mess and it becomes unlisted/unordered and no CSS cannot be applied because all divs and classes (even/odd) are gone.

It works fine via original node, but divs are stripped via Views.


texts: Display a grid view without border columns

texts:
I'm trying to display a specific number of products in a e-commerce drupal site in the front page.

I would like to use a display as in my theme's demo : http://demo.morethanthemes.com/tophit/

I tried one module for horizontal slideshow but it turned out to have some bugs and another one for responsive grid did not help me fix my problem.

I am now using the original grid view, without pager.

I want to change the column color from grey to white, in order to be my products aligned but not displayed as a table.

Do you know any way to simple display a set of products/nodes horizontal ?
I prefer to use views, because the products probably will change.

Thank you,

Konstantina


texts:
I'm using a Geolocation Fields View with Drupal 8 and need to manipulate the Style of the Marker Info Window.
there is no class to style the pop-Up-window for the Info Text.
The Info Text has a class named gm-style-iw.
I would like to do this:

var popupcontent = $('.gm-style-iw');
popupcontent.parent().addClass('gmap-popup');

But I can't get the right event.
I can get the Click on Map Event with this:

   if (typeof Drupal.geolocation !== 'undefined') {
     Drupal.geolocation.googleCallbacks.push({'callback' : function () {
        Drupal.geolocation.maps[0].googleMap.addListener('click', function() {
        console.log('Clicked on the map.');
        });
     }});
    }

But I need to get the Click on Marker Event.
I can not figure out the Marker Objekt and the right syntax for the click event.


texts:
I'm building a custom Drupal theme and wondering if there is a way to get the modal windows to use the default admin theme. I'm using the Layout builder module with a custom block that uses the Media Library module and it uses jQuery UI classes.

This is also for the modal content like the media modal.


texts: Taxonomy manage fields wrong field edit url

texts:
I have updated my project to the latest updates available using drush and suddenly found no field names and wrong field form url in

 admin/structure/taxonomy/%taxonomy_name/fields

As in the picture, have that issue happened before and how to fix

Edit: I coudn't also be able to add new fields and fatal error occurs

FieldException: Attempt to update an instance of a nonexistent field . in field_update_instance() (line 557 of /modules/field/field.crud.inc

despite being able to add/edit/delete terms

manage display return error

Fatal error: Unsupported operand types in /modules/field_ui/field_ui.admin.inc on line 1025

The issue is reported in issue nr 1275900.

It only happened with taxonomy and other entities work fine.


texts: User->id() or Node->id() do not give back an integer but a string?

texts:
I have written a custom class contructor (classname UserHandler) where I want to have a parameter which can be an instance of Drupal\user\Entity\User, an integer or FALSE:

  public function __construct($user = FALSE) {
    if ($user && $user instanceof User ) {
      $this->account = $user;
    }

    if ($user && is_int($user)) {
      $this->account = User::load($user);
    }

    if (!$user) {
      $this->account = User::load(Drupal::currentUser()->id());
    }

    $this->setProfileId();
  }

When I instantiate this class by calling UserHandler() or UserHandler($someUserClassInstance) everything works fine. When I want to instantiate this class by using a user id to load the user object in the constructor it works just fine as well: UserHandler(65).

But the problem appears when I want to use the id from any kind of entity or accountproxy class. Example in a hook_node_access:

function custom_node_access(NodeInterface $node, $op, AccountInterface $account) {
  $profile = new IgbUser($account->id());
}

$account is a class instance of Drupal\Core\Session\AccountInterface. When I call $account->id() the value returned is a string not an integer. This leads to the problem that a check like is_int($account->id()) becomes false. This appears with $node->id() as well for example.

Maybe I did not get some basics in PHP classes but all the comments above the id() methods in all the classes state that they would return an integer?!

Best,
Tobias


texts: Notification of new comments for author and comment writers

texts:
I'm trying to implement a rule (in D7) that will automatically (no check box or opting out):

send an email to the author of node if new comments
send email to all users who have commented on that node
not send email to author of own comment

I did find instructions for one of the above, but not for all of them in the same rules. And this is where I failed.

Any help?


texts:
I'm trying to override the search--results.html.twig file.

And it says i can use info_split.date to render the dates.

But when I try

{% if info_split.date %}
  {{ info_split.date }}
{% endif %}

It does nothing, and kint says it's an empty array.


texts: Create and update PostgreSQL view from Drupal view

texts:
Do you know about any way to automatically create and update PostgreSQL view from Drupal view? The reason is, that there are some applications, which can use DB view, but not Drupal one, such as QGIS or JasperReports.

I know, that:

I can copy SQL command from views (module) interface, but that's not very practical, since I would need to recreate view (on DB level) on any edit.
It's not possible to convert some Views features, such as permissions handling or any other functionality which is dependent on hooks.


texts: Plans for a D7 version of the Spam module, and possible alternatives?

texts:
I am thinking about porting an existing D6 site to Drupal 7. The main shortcoming that I see is that the splendid Spam module is still missing for Drupal 7.

I don't want to relay on third-party services, so I wonder whether there is any plan to port the Spam module to Drupal 7 and if not, what alternative spam filter can be used for Drupal 7.


texts: MathJax(LaTex) equation shows in the CKeditor body area but not on the final webpage?

texts: I am using CKEditor module and have enabled MathJax option. When I use MathJax it works in the CKeditor and shows teh eqiation, but on the final display webpage instead just showing equations it is showing all code. What could be the reason and solution?


texts: IMCE attempting to upload file greater than 10MB

texts:
Try to upload a PDF files around 30MB.
I can upload files < 10MB including PDF file no problem.

IMCE settings:
Profile User-1:
All settings are set to max eg.Maximum file size per upload set to 0
Permitted file extensions set to *
Maximum number of files per operation set to 0
Directories: root/. (ie. the default . in textbox)
include subdirectories checked.

PHP info settings (confirmed with phpinfo())
post_max_size 300M
upload_max_filesize 300M

Also tried
MaxRequestLen 300000000

What am I missing?

Mohan


texts:
I'm currently performing an entity query like so.

$search = 'test';
$type = 'page';
$query = \Drupal::entityQuery('node')
    ->condition('type',$type);

I'm then adding an 'or' condition like so

$or_condition = $query->orConditionGroup()
    ->condition('title', '%'.$search.'%', 'like')
    ->condition('body', '%'.$search.'%', 'like');
$query->condition($or_condition);
$query->execute();

This works with no issue, but I would like to be able to continue to add conditions to the $or_condition. Here is my attempt.

$search[0] = 'test';
$search[1] = 'test2';

$query = \Drupal::entityQuery('node')
    ->condition('type',$type);

$or_condition = $query->orConditionGroup()
    ->condition('title', '%'.$search[0].'%', 'like')
    ->condition('body', '%'.$search[0].'%', 'like');
$or_condition->condition('title', '%'.$search[1].'%', 'like')
    ->condition('body', '%'.$search[1].'%', 'like');
$query->condition($or_condition);
$query->execute();

However the code above does not work.
The ultimate goal is to be able to explode a user provided string and include it into the or condition so the word order of what the user searches doesn't matter.
Is there a way to append conditions to an or condition group outside of the declaration statement?


texts: Is there a simple way to move the comment form above the comments in Drupal 6?


texts: Add CKEditor widget (footnotes) from external addon

texts:
I want to add CKEditor footnotes addon to a Drupal 8 toolbar.

The plugin seems to load as I can add the button when configuring the input format  and I see CKEDITOR.plugins.externals.footnotes is defined and pointing to my plugin file. However the button does not show in the toolbar. No errors or warnings in the console.

This is my /modules/custom/ckeditorfootnotes/src/Plugin/CKEditorPlugin/CKEditorFootnotes.php

class CKEditorFootnotes extends CKEditorPluginBase implements CKEditorPluginInterface, CKEditorPluginButtonsInterface {

  /**
   * Implements \Drupal\ckeditor\Plugin\CKEditorPluginInterface::getFile().
   */
  function getFile() {
    return drupal_get_path('module', 'ckeditorfootnotes') . '/js/footnotes/plugin.js';
  }

  /**
   * Implements \Drupal\ckeditor\Plugin\CKEditorPluginButtonsInterface::getButtons().
   */
  function getButtons() {
    return array(
      'CKEditorFootnotes' => array(
        'label' => t('Footnotes'),
        'image' => drupal_get_path('module', 'ckeditorfootnotes') . '/js/footnotes/icons/footnotes.png'
      )
    );
  }

This is  filter.format.basic_html

    uuid: b47ec9da-02dc-420c-8100-c2127d8e5012
    langcode: ca
    status: true
    dependencies:
      module:
        - editor
    name: 'HTML bàsic'
    format: basic_html
    weight: 0
    filters:
      filter_html:
        id: filter_html
        provider: filter
        status: false
        weight: -10
        settings:
          allowed_html: '<a href hreflang target> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id> <p> <br> <span> <img src alt height width data-entity-type data-entity-uuid data-align data-caption> <s> <table> <caption> <tbody> <thead> <tfoot> <th> <td> <tr> <sub> <sup> <section>'
          filter_html_help: false
          filter_html_nofollow: false
      filter_align:
        id: filter_align
        provider: filter
        status: true
        weight: 7
        settings: {  }
      filter_caption:
        id: filter_caption
        provider: filter
        status: true
        weight: 8
        settings: {  }
      filter_html_image_secure:
        id: filter_html_image_secure
        provider: filter
        status: true
        weight: 9
        settings: {  }
      editor_file_reference:
        id: editor_file_reference
        provider: editor
        status: true
        weight: 11
        settings: {  }

And finally editor.editor.basic_html

uuid: 175d53b1-06a9-4aca-9755-85595f23633b
langcode: ca
status: true
dependencies:
  config:
    - filter.format.basic_html
  module:
    - ckeditor
    - editor_file
third_party_settings:
  editor_file:
    status: true
    scheme: public
    directory: inline-files
    extensions: txt
format: basic_html
editor: ckeditor
settings:
  toolbar:
    rows:
      -
        -
          [... several groups ...]
        -
          name: Media
          items:
            - CKEditorFootnotes
            - DrupalFile
            - Blockquote
            - DrupalImage
            - Table
        -
          [... more groups ...]
  plugins:
    stylescombo:
      styles: ''
image_upload:
  status: true
  scheme: public
  directory: inline-images
  max_size: ''
  max_dimensions:
    width: null
    height: null


texts:
Is there a way to create a menu that links to a managed file? I tried many times, but nothing I tried works.

Do you have any idea?


texts: I have 4 webforms on a site and I would like to be able to display the data from each of those in a table using a view. Each of the forms has a "First Name" "Last Name" "Phone Number" and "Email Address" field, along with other fields that are specific to the different forms. Ideally, I would like to have a table that shows those 4 fields from all of the forms along with a column that says what form it came from. Can anyone give me an idea of where to start? My assumption is that the answer is somewhere in relationships and contextual filters, but I'm still learning how all of that stuff works. Any help or advice would be greatly appreciated. Thanks!!


texts:
Here's my case:

I have a content type with
-- field collection fc_file
I have a taxonomy term with
-- the same existing field collection fc_file
In my field collection, I have:
-- file pdf field fc_file_pdf
I've created a node and taxonomy term with a pdf file.

Here my problem:

I created a view field collection.
I have all the list a my pdf files from node and taxonomy
But if I add a relationships Field collection item : Entity with the fc_file suppose to join to all the entity which have this field collection ( So in my case node and taxonomy ), but the result gives my only the list of the file from node.

Is somebody able to explain me why?


texts: Assign a row class like "row-1" for row 1, "row-2" for row 2

texts:
I have a view that uses the Table format.
I want to add row classes like this:

Row 1: .row1
Row 2: .row2
Row 3: .row3

In the Views UI, if I click Settings under Format: Table, then I can specify the Row class.  This field allows tokens, but I can't find a token that refers to the views row itself.
How can I implement a row class that assigns a number based on the position of the row in the view?


texts: Required field not being shown on password reset page

texts: We have a terms and conditions checkbox boolean which is required to create an account. It's created in the Manage Fields section under People.  We have set that checkbox to Required, and it works. But when a user goes to reset their password the form cannot be submitted because the field is required but it's hidden from the form. In the manage display for the boolean field it's set to display and shows for the user. Any idea why this field is hidden from users on password reset form but not account creation or their profile page?


texts: How can I add a wrapper around my nodes?

texts:
How can I wrap my nodes (output in teaser view) in a
 element?

My title

  //
 <--- add this

...

...

...

    ...
  //
 <--- add this


texts:
I have a custom table (myusersession) which contains the uid field that is a reference to user entities.

How can I add user entity fields (exactly 'name') to my view?

I tried many variations of join, in hook_views_data(), but none of them works.

  $data['myusersession']['table']['join'] = array(
    'users_field_data' => array(
      'field' => 'uid',
      'left_field' => 'uid',
    ),
  );

  $data['myusersession']['uid'] = array(
    'title' => t('UID'),
    'help' => t(''),
    'field' => array(
      'id' => 'numeric',
    ),
    'filter' => array(
      'id' => 'numeric',
    ),
    'argument' => array(
      'id' => 'numeric',
    ),
    'relationship' => array(
      'title' => t('User'),
      'help' => t(''),
      'base' => 'users',
      'base field' => 'uid',
      'id' => 'standard',
    ),
  );

I also tested variations of the table name, such as users_field_data, users, and user.

As I understand the following code should be work, but it doesn't in my case.

    'relationship' => array(
      'title' => $this->t('User'),
      'label' => $this->t('User'),
      'base' => 'users',
      'base field' => 'uid',
      'relationship field' => 'uid',
    ),

With ['table']['join'], the table appears as column on the view with User as base, but but if the view base is myusersession, User doesn't appear.


texts: Related Terms Block Based on Terms Fields

texts:
I am not sure where to begin except experimenting with contextual filters which is not getting me very far. I am trying to display taxonomy terms in a block based on if a certain field has the same info that is on the same taxonomy page.

For example

Current term page = Radioshack
Radioshack has the fields:
Term Field City: San diego
Term Field Type: Electronic

And the terms I want to list would be
Term: Frys Electronics
Term Field City: San Diego
Term Field Type: Electronics Store

Term: Best Buy
Term Field City: La Jolla
Term Field Type: Electronics Store

So if you notice they all have the same type which is electronic store so it would display those 2 terms on the current page which is radioshack and any other terms with the same type electronics


texts: how to create shell command 'd' as equivalent to 'drush'?

texts:
Typing "drush" over and over again, I find it is quite time consuming.  How can I shorten the command so I can just type "d"?

I am using Mac OS X.


texts:
I have a ReactJS app that fetches an external API URL with the following structure.

fetch(url) // or fetch(url, {mode:'cors'})
  .then(response => response.json())
  .then(data => {

In my browser, when it tries to render the component, I am getting the following error message

  Failed to load https://XXXXX/jsondata: No
  'Access-Control-Allow-Origin' header is present on the requested
  resource. Origin 'http://localhost:8080' is therefore not allowed
  access. If an opaque response serves your needs, set the request's
  mode to 'no-cors' to fetch the resource with CORS disabled.

So I research how to enable CORS in Drupal 8 and doing trial and error for different configurations didn't work.

This is my current cors.config under services.yml file

  cors.config:
    enabled: true
    # Specify allowed headers, like 'x-allowed-header'.
    allowedHeaders: ['x-csrf-token','authorization','content-type','accept','origin','x-requested-with', 'access-control-allow-origin','x-allowed-header','*']
    # Specify allowed request methods, specify ['*'] to allow all possible ones.
    allowedMethods: ['*'] // or ['POST', 'GET', 'OPTIONS', 'DELETE', 'PUT', 'PATCH']
    # Configure requests allowed from specific origins.
    allowedOrigins: ['https://XXXX/','*']
    # Sets the Access-Control-Expose-Headers header.
    exposedHeaders: true // or false
    # Sets the Access-Control-Max-Age header.
    maxAge: false // or 1000
    # Sets the Access-Control-Allow-Credentials header.
    supportsCredentials: true // or false

I have tried to install a Chrome extension that is amazing that removes this error but of course this will only be working in my device.

Im not entirely sure but is this something to change Drupal CORS config or allowing Access-Control-Allow-Origin on the API URL side (https://XXXX)?


texts: What do I need to do to successfully enable Facebook login for my site?

texts:
I'm trying to setup Facebook login integration for my Drupal site using the HybridAuth Social login module. It is not working with "Use Strict Mode for Redirect URIs" enabled and I am failing to disable it. I think it's an issue of the redirect_uri setting.

I tried it with
siteurl/hybridauth/endpoint?hauth_done=Facebook and siteurl/hybridauth/endpoint?hauth.done=Facebook but it's not working.

Here is the error:

  THERE WAS AN ERROR PROCESSING YOUR REQUEST.

And in my Drupal log:

  Exception: Facebook Graph returned an error: URL can not be loaded: The domain of this URL is not present in the domains of the app. To be able to load this URL, add all your domain's domains and subdomains in the Appdomain box in your app settings. in Hybrid_Auth :: initialize ()

What do I need to do to successfully enable Facebook login integration for my site?


texts: Should the Drupal 8 sites/default/files/config folder be stored in git with its hash suffix?

texts:
New question title: "Should the sites/default/files/config folder be stored in git with it's hash suffix?"

" Reason I ask this is that this might cause 2 issues:

May be a hindrance when comparing code bases of sites, the diff comparison program would not be able to compare the contents of the config folder directly, if the suffixes are different.
If the site is a open collaboration project, where the code is put on github or bitbucket publicly, then the config hash suffix which is normally secret would be visible to the public and therefore the folder can be determined but the intent was to use the hash to make the folder harder to guess for security reasons.

Original question title: "Why does the Drupal 8 config folder have a long gibberish-like name, e.g.: config_wNOLcm... etc?"

Answer to the question about the 'gibberish' is:

  This sequence is a random hash generated during the installation of
  your Drupalvsite. It is used to add some protection to your
  configuration files. Additionally to the default restriction enforced
  by the .htaccess file within the subdirectories of the config
  directory that prevents unauthorized users from seeing the content of
  the directories. As a result, would be really hard for someone to
  guess the folder's name.

Credit: Drupal 8 Configuration Management, First published March 2015, page 29

Some general references:

https://www.drupal.org/node/2360331#how-do-i-version-my-


texts: How to render in template file with some conditions?

texts:
I want to use render function but I don't want to show all the data which is there in the particular field. So how can restrict something from rendering in template file. Scenario is:

I have reference one field to another contentype, and I am rendering field in template file. But problem is even though the referenced node is not published, that data is displaying in the rendered field. So how can I restrict like if node is published then only I want to display that data.

One more concern is if it is possible with inbuilt functions only that will be great that saves my time of writing code and designing the data.


texts: How do I use the message module with the flag?

texts:
On Drupal 8 I installed the "Message" and "Flag" modules.

I created a flag "Report content" and I want a message to be sent to the site administrator as soon as a content is reported.

Messages will be displayed in a table view.

The "Report content" flag includes a "Pattern" field.

The message must contain the date of the flag, the author of the flag, the flagged node and the pattern of the flag.

For the flag no problem, but for the module "Message" it is a discovery.

After creating a message template "Reported Content", what should I do?

I read all the documentation and I can not.

I also installed the mudule "Message notify" and "Message UI".


texts: I know I can translate to current website language with t() function, but I need translate to specified (not current) language, my site has three languages and I want get English of some of the worlds in some template files when current language is French. How can I get translate of string according to specified language instead of current language?


texts: Drupal 8 custom block with html and javascript

texts:
In Drupal 8 what is the process for creating blocks with html and javascript?

Here is my sample code for creating the block

class TopNewsBlock extends BlockBase {

  /**
   * {@inheritdoc}
   */
  public function build() {
     //Fetch data
     return array(
      'type' => 'markup',
      '#markup' => '

',
      '#attached' => array(
        'library' =>  array(
          'custom_cms_blocks/dataTables.dataTablesjs',
          'custom_cms_blocks/top-news-library'
        ),
      ),
     );
  }

}

It works but the problem I have is - I want to seperate out the html code from the php code. Is it possible to include a html file within the block just like the way a javascript file is attached as a library?


texts: How do I get the full URL of the current page?

texts:
I need to get the full URL of the currently opened page. I use the following code, but it returns http://localhost/mysite/page_name.

$path = isset($_GET['q']) ? $_GET['q'] : '<front>';
$link = url($path, array('absolute' => TRUE));

It's not enough for my code to complete; I want to get the values that are passed with the URL as http://localhost/mysite/page_name/value1=value&value2=value.

How can I do that?


texts: Is it possible to change the view type form "content" to "content revision"?

texts:
I created a view with several displays.
The view type is CONTENT.

But now I need to change the type from CONTENT to CONTENT REVISION, without to be constrained to rewrite all the displays.

Is it possible?


texts: Single webform on multi-language site with different url aliases

texts:
I have multi-language site with webform. I want to use the same (single) webform for each language so I used Webform Localization module to translate the webform via string translation. Everything works, but the urls now looks like /en/node/123 and /cs/node/123.

I'd like to have separate url aliases for each language, e.g. /en/my-form and /cs/muj-formular. How to achieve this?


texts: Why does drush en give differerent results than enabling mymodule in the ui?

texts: When I perform drush en mymodule -y my module enables no problems. When I do the same in the UI it seems to install great. No errors. However the roles defined in hook_install() are not created. In Drush they are. What is the difference between Drush and Enabling the module in the UI?


texts: Migrate Drupal 8 install from one server to another

texts:
I've been using Drupal since 4.6 and it's always been easy to copy a site from one server to the other. Make up a tarball, do a database dump, go to the new machine, unpack the tarball and load in the data and you're good to go.

I'm not finding this to be the case at all in D8. Every time I try to move between servers, I end up with fatal errors.

I find that I have to end up doing an install from scratch and then loading the database into the new install. That works, but then my /sites/default/files/config_[hash] are different, so the sites are out of sync.

What am I missing? In theory, the Configuration Initiative was supposed to make this easier, but so far for me that has not been the case.

BTW
 - instructions on "rebuild" - https://drupal.org/documentation/rebuild
 - managing config: https://drupal.org/documentation/administer/config


texts:
Is the Demo Framework project not compatible with Composer 2.0? Are there any workarounds?
The output of composer create-project acquia/df-project DemoFramework -s dev is the following one.

Creating a "acquia/df-project" project at "./DemoFramework"
Installing acquia/df-project (dev-8.x-4.x 078c5f127d485581ce056a71e5ff98b5b2518717)

Syncing acquia/df-project (dev-8.x-4.x 078c5f1) into cache
Installing acquia/df-project (dev-8.x-4.x 078c5f1): Cloning 078c5f127d from cache
Created project in /var/www/html/drupal/DemoFramework
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

Problem 1

acquia/df[4.0.2, ..., 4.1.1] require cweagans/composer-patches 1.6.6 -> satisfiable by cweagans/composer-patches[1.6.6].
cweagans/composer-patches 1.6.6 requires composer-plugin-api ^1.0 -> found composer-plugin-api[2.0.0] but it does not match the constraint.
Root composer.json requires acquia/df ^4.0.2 -> satisfiable by acquia/df[4.0.2, ..., 4.1.1].

You are using Composer 2, which some of your plugins seem to be incompatible with. Make sure you update your plugins or report a plugin-issue to ask them to support Composer 2.


texts:
I have just started using Drupal (Drupal 7) and I would like your help to do something.
I have created a field called : Current Project where each user writes the project they are currently working on.
I want to create a view in each user's profile page that will show all the other users that work on the same project.
I tried to create this using the Views module but I can only insert a specific value as a filter. What I would like to do is to create a view that will show all users that have the same Current project as the viewed user.
Thank you very much for your help.


texts: Is it possible to avoid using Views PHP?

texts:
I have a number of values that I need to run a bit of logic on to get a value for a views math expression further down the chain. Im going to provide a much simpler example of what I am actually doing...

Variables set on custom module admin page...

twoyr_a = 5.4
twoyr_b = 12.4
threeyr_a = 5.6
threeyr_b = 12.7
fouryr_a = 5.8
fouryr_b = 13.3

Contract term (Factor A) - Overidden with views-views-field--factor--a.tpl.php

if ($output == '24') {
    print variable_get('twoyr_a');
} elseif ($output == '36') {
    print variable_get('threeyr_a');
} elseif ($output == '48') {
    print variable_get('fouryr_a');
} else {
    print '0';
}

Contract term (Factor B) - Overidden with views-views-field--factor--b.tpl.php

if ($output == '24') {
    print variable_get('twoyr_b');
} elseif ($output == '36') {
    print variable_get('threeyr_b');
} elseif ($output == '48') {
    print variable_get('fouryr_b');
} else {
    print '0';
}

Views Global:Math Expression

[factor_a] + [factor_b] = result

However, the result is always wrong. Instead of using the result from the PHP template, it is adding the Contract terms (24 + 24 = 48).

Im guessing this is because the math expression runs before the template files do.

So my question is, is there anyway to avoid using Views PHP for this? Or is there a fix for my current solution?

Note: $output is already defined in the database as 24, 36, or 48 in a "Contract Term" column. It relates to just a normal field in an ECK entity type called "Deal". It's an integer value to define the length of a contract for that deal. Each contract term has its own A and B factors to calculate my clients profit percentage when borrowing from a loan company.


texts: Mapping or migrating path alias using using Migrate Source CSV

texts:
I am importing content from SharePoint into Drupal 8 using Migrate Source
CSV and a large CSV file. I successfully mapped id,title,body,date. But I
cannot map the path alias? In Drupal 7 the Feeds module mapped this easily.
Does anyone know how to do this in Drupal 8?

This is a snippet from my yml file:

process:
  id: id
  nid: nid
  title: title
  alias: path
destination:
  plugin: entity:node

my csv file

"id","nid","title","body","path","date"
"1","1","title1","bodytext","content/12/mypath","2014-08-12"


texts: Create just one .tpl.php file for several nodes?

texts:
I created these .tpl.php file for two node:

html--node__39.tpl.php
html--node__14.tpl.php

Question: can I create just one file for both node?, something like:

html--node__39&&14.tpl.php


texts: Why and when is feeds_entity_load needed

texts:
I have the feeds module enabled and when I load a basic view, it generates 688 calls to the function feeds_entity_load which generate as many database query, which degrades the performance.

Why are these call needed ? For me feeds is only use to import data, so why is it impacting every single page load ? I'm thinking of deactivating this function but I would like to understand if it's safe to do so.


texts: CAPTCHA session reuse attack detected error message when form is submitted

texts:
I am experiencing problems with the captcha module 7.x-1.0-beta1 version. I have enabled captcha in webforms for anonymous users. After submitting the form it repeatedly gives me the error message,

  CAPTCHA session reuse attack detected

.. This happens for only one of the webform in which captcha is placed. I am using Drupal 7.2 version.

Any solution for this issue will be really helpful.


texts: How to do arithmetic on a contextual filter

texts:
Rather than specifying a contextual filter, is it possible to specify a contextual filter +1 (i.e. add one to the current filter value?)

If you have a view taking an argument, i understand that you can create a global text field to make a link to a different view using the original argument.

I.e. in view1/arg1 i can have a global text field which outputs as a link to
view2/arg1

Is it possible to create a global text field which outputs as a link to view2/arg1+1

i.e. adds one to the current argument?


texts: Why does my do-nothing subtheme break the parent theme?

texts:
I'm trying to get started with sub theming in Drupal 8. I followed the example from the Drupal documentation and created what I thought was supposed to be an unmodified inherited copy of the Bartik theme, but the main navigation menu is changed per the below screenshots. My code is as follows, identical to the tutorial other than Bartik as the base theme.

What am I missing here? Why am I not starting with an identical layout to the Bartik theme?

info.yml:

name: wilmettewatch
type: theme
description: Wilmette Watch's theme based off Bartik for now
core: 8.x
# Defines the base theme
base theme: bartik
# Defines libraries group in which we can add css/js.
libraries:
  - wilmettewatch/global-styling
# Regions
regions:
  header: Header
  featured: Featured
  content: Content
  sidebar_first: First sidebar
  sidebar_second: Second sidebar
  footer: Footer

libraries.yml:

global-styling:
  css:
    component:
      css/style.css: {}

Bartik Theme:

My Sub Theme:


texts: how to update my custom table after execution of rules

texts:
i have created a table as follow

<?php

/**
 * @file
 * Implements hook_schema
 */
function core_sms_schema() {
  $schema['core_sms_details'] = array(

    'description' => 'This table is used to keep track of sms sent/failed on specific date.',
    'fields' => array(
      'id' => array(
        'description' => 'The primary identifier for a node.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'date' => array(
        'description' => 'Date',
        'mysql_type' => 'TIMESTAMP DEFAULT CURRENT_TIMESTAMP',
        'not null' => TRUE,
      ),
      'sms_sent' => array(
        'description' => 'The SMS sent on particular date.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => '0',
      ),
      'sms_failed' => array(
        'description' => 'The SMS failed on particular date.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => '0',
      ),
    ),
    'primary key' => array('id'),
  );
  return $schema;
}

After a sms has been sent i have to update the columns with number and date. i already have rules also but not able to get how to update the custom table using rules.


texts:
My stakeholders encountering a situation where they have to do finagling in the CKEditor window when they copy and paste from Google Docs, which they do often.

Ideally, what would happen is that inline styling information is stripped out from pasted tags, while preserving other styling information. For instance, here's the tag for some large-sized text, copied from Google Doc's resume template, and pasted in to CKEditor in Drupal 8.6.13:

Your Name

Is there a way to strip out the font-style and font-size attributes on page? I've googled for information on the Drupal side, and also on the CKEditor site, but I haven't found positive confirmation that this is possible.

I see that there are modules for CKEditor that provide a "Paste from Google Docs" button, but my team doesn't want another button they have to remember to use when they are pasting from Google Docs -- they want this to work with the default paste functionality. We will never be using the source font-size and font-family, because we have a style guide for our entire site which is standardized.

I am aware that typeface can be handled differently (e.g. styling  tags as bold instead of using font-weight:bold, etc), but we can deal with that. What I am looking for is how to get rid of the font family and font size.

As regarding custom text filters, I looked at this tutorial and downloaded and installed the sample celebrate custom text filter module. Upon testing, I confirmed that it only changed text when I saved the node, not when I pasted into the CKEditor textarea widget. So a custom text filter module does not do what I want.


texts: EntityQuery with node_access module compatibly

texts:
I have installed node_access for maintaining access per node. I need to write a sql query using entityQuery service and display only those nodes which respect node_access configuration per node. I am not able to find any documentation for this.
Currently my entityQuery is showing all results to ananymous users. Please let me know If one write query to resepct node_access module.

$query = \Drupal::entityQuery('node');
$query->condition('type', 'article');
$nids = $query->execute();


texts:
I'm getting the following error on the return page of my off-site payment:

#1 ... /httpdocs/core/modules/editor/editor.module(554): _drupal_error_handler(4096, 'Argument 1 pass...', '... /httpdocs/ ...', 554, Array)
#2 ... /httpdocs/core/modules/editor/editor.module(384): _editor_get_file_uuids_by_field(NULL)
#3 [internal function]: editor_entity_update(Object(Drupal\commerce_order\Entity\Order))
#4 ... /httpdocs/core/lib/Drupal/Core/Extension/ModuleHandler.php(402): call_user_func_array('editor_entity_u...', Array)
#5 ... /httpdocs/core/lib/Drupal/Core/Entity/EntityStorageBase.php(169): Drupal\Core\Extension\ModuleHandler->invokeAll('entity_update', Array)
#6 ... /httpdocs/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(730): Drupal\Core\Entity\EntityStorageBase->invokeHook('update', Object(Drupal\commerce_order\Entity\Order))
#7 ... /httpdocs/modules/contrib/commerce/src/CommerceContentEntityStorage.php(88): Drupal\Core\Entity\ContentEntityStorageBase->invokeHook('update', Object(Drupal\commerce_order\Entity\Order))
#8 ... /httpdocs/core/lib/Drupal/Core/Entity/EntityStorageBase.php(470): Drupal\commerce\CommerceContentEntityStorage->invokeHook('update', Object(Drupal\commerce_order\Entity\Order))
#9 ... /httpdocs/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(615): Drupal\Core\Entity\EntityStorageBase->doPostSave(Object(Drupal\commerce_order\Entity\Order), true)
#10 ... /httpdocs/core/lib/Drupal/Core/Entity/EntityStorageBase.php(395): Drupal\Core\Entity\ContentEntityStorageBase->doPostSave(Object(Drupal\commerce_order\Entity\Order), true)
#11 ... /httpdocs/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(820): Drupal\Core\Entity\EntityStorageBase->save(Object(Drupal\commerce_order\Entity\Order))
#12 ... /httpdocs/core/lib/Drupal/Core/Entity/Entity.php(391): Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object(Drupal\commerce_order\Entity\Order))
#13 ... /httpdocs/modules/contrib/commerce/modules/checkout/src/Plugin/Commerce\CheckoutFlow\CheckoutFlowBase.php(130): Drupal\Core\Entity\Entity->save()
#14 ... /httpdocs/modules/contrib/commerce/modules/payment/src/Controller/PaymentCheckoutController.php(88): Drupal\commerce_checkout\Plugin\Commerce\CheckoutFlow\CheckoutFlowBase->redirectToStep('complete')
#15 [internal function]: Drupal\commerce_payment\Controller\PaymentCheckoutController->returnPage(Object(Drupal\commerce_order\Entity\Order), Object(Symfony\Component\HttpFoundation\Request))

(any stack beyond this is, afaik, Drupal boiler plate)

Digging into editor.module, obviously the original property of my order entity is NULL, and that causes the error.

Does this indicate that my order has not been updated, and does not need saving? As in, I should just patch the CheckoutFlowBase class to check if the original property is set, and if so, save?

Or is the fix going to have to be more complicated?


texts:
I am working on Drupal 8 project

I have made a content type by name glossary having machine name glossary
Also, I have made one field in it, i.e. description having machine name field_description.
As it is a content type, in order to add a Glossary term via REST,
I am using the following

URL: http://example.com/entity/node?_format=json

METHOD: POST

Passing Headers as Authorization with its value & Content-Type as application/json

and Body as

{
  "type":[{"target_id":"glossary"}],
  "title":[{"value":"haha"}],
  "field_description":[{"value":"Howasdasdd are you?"}]
}

  Status 500 Internal Server Error

  Response A fatal error occurred: Internal Server Error

I checked into Drupal logs I got the following message.

  Drupal\rules\Exception\EvaluationException: The context for node is
  NULL, but the context node in rules_node_is_of_type requires a value.
  in
  Drupal\rules\Plugin\RulesExpression\RulesCondition->prepareContext()
  (line 98 of
  /var/www/vhosts/readyresponders.org/staging/dashboard/modules/contrib/rules/src/Context/ContextHandlerTrait.php).


texts:
My print-friendly version replaces the thumbnail images with the hi-res versions which is fine, but the PDF version replaces the images with the alt tag.

Anyone have any ideas on how I can get the PDF varsion (DomPDF) to behave when dealing with the thumbnails?


texts:
Is it necessary to write all the mobile app's own html files for displaying Drupal configured Blocks / Pages / Views? I was hoping I could just rebuild my primary Navigation menus using the DrupalGap settings.php files or hook_menu, but leave the callbacks to just inject the return HTML?

For example...

drupalgap.settings.menus['user_menu_standard'] = {
    links:[
    {
        title: 'A Title',
        path: '/some-content-type',
        options: {
            attributes: {
                'data-theme': 'b'
            }
        }
    },
};

function my_module_menu() {
  var items = {};
  items['airlines'] = {
    title: 'airlines',
    page_callback: 'my_module_airlines_page'
  }
  return items;
}

// No mobile dedicated html file necessary. I essentially want a webview with a phonegap native menu.
function my_module_airlines_page(html) {
  div.innerHTML = html;
}

Is this - or something similar - possible to automatically reuse the Drupal's front-end within DrupalGap?


texts: Views Data Export print feed icon in template file

texts:
I created a template for my view (views-view-fields-xxx.tpl.php).  On my view page I use the 'Views Data Export Module' to export filtered views in XLS format.

I cannot figure out how to display the button on the top of the page.  I tried printing it out in my template file using :

<?php print $view->feed_icon ?>

but then it prints out the button on every field view.  Is there a way to print this field only once? Or another way to move the "feed-icon" to the top of my page?


texts:
I have this code:

global $user;

if (!$user->uid) {
  drupal_set_message("You must log in to view this content.");
  drupal_goto('node/153', array('query'=>drupal_get_destination()));
}

$user->uid evaluates correctly when logged in as admin and editor, but users that don't have admin or editor roles have NO UID. Immediately before and after this code resolves to false, I visit site-root/user, and sure enough, I'm logged in.

What setting causes this?  I've used this code many times to see if a user is logged in, and I can't find any setting that would cause this behavior.


texts: Using Fivestar to list items that are 'trending' (highly rated in the last week)

texts:
I would like to create a list of items that are 'trending'. By 'trending' I mean nodes (in my case, Watches) that have been highly rated within the last several days. Right now I have a block that displays the 4 highest rated Watches, and would like to create a similar block that displays the 4 highest rated Watches, but only using votes that have been cast within the last 3 days.

For the trending block, I have the following filter criteria (the content type for a watch is Watch Detail):

Content: Published (Yes)
Content: Type (= Watch Detail)
(Vote results) Vote results: Timestamp (>= -3 days)

The watches are sorted by highest rated using the following sort critera:

(Vote results) Vote results: Value (desc)

It's a fairly standard view, and I used the Relationship Content: Vote results to access the voting results for sorting and filtering.

The problem with what I've done is that while it is filtering by watches that have received votes within the last 3 days, it is not calculating the average value of the rating on votes that have been cast in the last 3 days. It is using the rating of the watch since the watch node was created. Hence, the Trending block and the Top Rated block essentially are identical, since the rating isn't limited to the last 3 days.

If anyone has done something like this I would very much appreciate some tips for how to limit the calculation the the average vote value to only votes cast within the last 3 days.

See http://ratemytimepiece.com/ for the exact website I'm working on if that helps you visualize this a little better.


texts: Language links shown enabled for pre-translated nodes

texts:
The current snapshot below is of a node which was edited before I installed i18n. So when I go to edit that node "Translate" tab does not appear.

I've many nodes like this. The problem in such nodes is that in the language switcher block, all languages are shown enabled even though translations aren't available.

What is the solution? Should I simply resave such nodes created before i18n was installed?

So in this current snapshot, all non-English languages should have been shown as striked as I've not enabled translation for this node.


texts: How do I check if a user may access a given route?

texts:
I am trying to render a link from a Url object and verify the user actually has access to that URL, like when viewing a node.

For some reason, this always returns FALSE, although the node is accessible when $language is the set language.

$_url = Url::fromRoute('<current>', [], ['language' => $language]);
if ($_url->access()) {
  // The code inside here is never executed.
}

How do I verify a user may access the given path, without actually loading the entity behind that path?

edit: current state:

$currentPath = \Drupal::service('path.current')->getPath();
$urlObject = Url::fromUserInput($currentPath);
$routeName = $urlObject->getRouteName();

$linkUrl = Url::fromRoute($routeName, [], ['language' => $dataLangId]);

debug($languageData['languageName']);
debug($linkUrl->toString());

if ($linkUrl->access()) {
  debug('access');
}
else {
  debug('denied');

}

results in:

  Some mandatory parameters are missing ("node") to generate a URL for route "entity.node.canonical


texts: Why not programatically created nodes in the simpletests?

texts:
Most core and many contrib simpletest test create nodes by preparing the interface, logging an admin in and then filling out the form on /node/add/foo. Not only is this terribly slow, it fails at the most basic rule of Testing: only test your own concerns; mock and stub the rest.

For a test, all I need is N nodes with X tags (taxonomy-terms) attached to them. I am (in no way) interested in whether or not some "Save" button exists somewhere; which is what I am testing when I follow along with core tests, e.g my helper function createNodesWithTags().

This helper is modeled after TaxonomyRSSTestCase which has the same concern as my: make sure there are some nodes with tags, so that some interface can then be tested using these nodes. The helper first creates an entity-field on the node type "article", required because otherwise one cannot add tags to that node. It then proceeds to open up the node/add/article-page, attaches the term and presses Save.

  private function createNodesWithTags($amount) {
    $field = array(
      'field_name' => 'taxonomy_' . $this->vocabulary->machine_name,
      'type' => 'taxonomy_term_reference',
      'cardinality' => FIELD_CARDINALITY_UNLIMITED,
      'settings' => array(
        'allowed_values' => array(
          array(
            'vocabulary' => $this->vocabulary->machine_name,
            'parent' => 0,
          ),
        ),
      ),
    );
    field_create_field($field);

    $this->instance = array(
      'field_name' => 'taxonomy_' . $this->vocabulary->machine_name,
      'bundle' => 'article',
      'entity_type' => 'node',
      'widget' => array(
        'type' => 'options_select',
      ),
      'display' => array(
        'default' => array(
          'type' => 'taxonomy_term_reference_link',
        ),
      ),
    );
    field_create_instance($this->instance);

    //Create N nodes and attach all N to tag1, N-1 to tag2, N-2 to tag3 etc.
    $attachable = $this->tags;
    for ($i = 0; $i < $amount; $i++) {
      // Post an article.
      $edit = array();
      $langcode = LANGUAGE_NONE;
      $edit["title"] = $this->randomName();
      foreach($attachable as $tag) {
        $edit[$this->instance['field_name'] . '[' . $langcode . '][]'] = $tag->tid;
      }
      $this->drupalPost('node/add/article', $edit, t('Save'));

      //remove one tag, so the next node gets one less tag attached.
      array_shift($attachable);
    }
  }

Why do core tests test this way? Why is TaxonomyTestCase concerned with whether or not saving a node works (i.e. an admin can be created, logged in and finds the Save button)? Why don't they just call node_save() or some other API?

Is there a reason why I should implement it this way too, instead of just dropping records in the database, possible trough the node_save() API?


texts: Use contextual filter global null to pass values to override field result

texts:
I come again with new question about Drupal Views and i hope you can help and explain me how to achieve this, I made a page view to display all my content (this works fine) with the following path:

/car/%/%/%

Now I want to get all the aliases of that path, for example: /car/2009/vw/jetta and then get %1=2009, %2=vw, %3=jetta and then use this to rewrite the output of a field to show something like this:

 [name],

and with this get my URL like: /details/2009/vw/jetta

I see that maybe this is possible with contextual filter: global: null. I tried to configure it but i only get the URL with tid's (/details/10/25/33) instead of the alias.

Can you explain me how can I configure global:null to get the values that i want without affecting my view results?


texts: hook_simplenews_scheduler_edition_node_alter does not work as expected

texts:
Using simplenews scheduler 7.x-1.0-beta2.  I created a template newsletter and scheduled it to be sent daily.

I created a simple function to insert a dynamic value into the body of the newsletter edition that is created from the source template:

function hook_simplenews_scheduler_edition_node_alter($edition_node, $scheduler_node) {
  $edition_node->body['und'][0]['value'] = 'my new value';
}

My expectation was that when a newsletter edition is created from my newsletter template ($scheduler_node), the body of the new edition would say 'my new value'.

What actually happens is that the email sent to the newsletter subscribers says 'my new value', but the body of the newsletter edition node that is physically created still contains the body from the template.

Any suggestions?


texts: Link a Drupal 7 site with a Facebook account

texts:
I would like to know if there is a Facebook App that can automatically post content from the feed generated by a Drupal 7 site to one's Facebook Wall.
I would like something that does what My Blog Posts Facebook App promises to do but more efficiently (since that works only by manually refreshing the state).

Thanks a lot !


texts:
I am trying to create a block using hook_block, in Drupal 7. I have the following code in my module file (module.module its not actually called that but, this is an example).

function module_race_results_block_info($op = 'list'){
  $block = array();

  if ($op == 'list') {
    $block[0]['info'] = t('Race Results Block');
  }

  return $block;
}

function module_race_results_block_view($delta = 'raceresults') {
  $block = array();

  switch ($delta) {
    case 'raceresults':
      $block['content'] = module_race_results();
      break;
  }

  return $block;
}

function module_race_results() {
  $content = "Testing Race Results Block";

  return $content;
}

How can I test this? The block is not showing up in the blocks list (/admin/structure/block).


texts:
There is a lot about theming custom blocks, but what about blocks created by views?

My views block has id: block-views-posts-listing-block,

I try many ways for naming template file, ex: block--block--views-posts-listing-block.tpl.php,
but I can't find correct file name.


texts:
I have a content type that has no limit on how many body fields it can have.

You can say that each body field represents a page in a book. You are supposed to switch page to see the next body field.

The client I am developing this site for needs to support visitors that have javascript disabled.

Is there a solution that makes it possible to add a pager for these fields using PHP?


texts: Default Breadcrumb is not working in bootstrap drupal 8?

texts:
I have rendered the breadcrumb in page.html.twig

{# Breadcrumbs #}
    {% if breadcrumb %}
      {% block breadcrumb %}
        {{ breadcrumb }}
      {% endblock %}
    {% endif %}

and default breadcrumb block is available in the block layout. And then I have assigned in the block in Highlighted region.

When I debugging the breadcrumb, its not working properly.

Please help me , how to sort out this issue?


texts:
I have Search API, Search API Solr and Facets setup in drupal 8.  The view settings used as data source for the facet is as below.

There are two content types: Language and Role.  Both are used as inline entities in other content types with field names: file_language and field_role.  The facet setting are as below:

However, in the facet browse view language is displayed with title link and role is displayed as node id link.

I am not sure which setting is causing this issue. How to display role by title, similar to language?

Thank you


texts: How to add an exposed filter to a view programatically?

texts:
How would one go about adding an exposed filter item to any given view programatically?

EDIT 1: This needs to happen during the request. So, I'm guessing some views hook needs to be used.


texts: Views: Insert Profile2 information in a node

texts:
I have a  problem and here's my graphical illustration of it:

I have tried many things that didn't work. I think the answer has something to do with adding a relationship with a node field, but I don't know how to get it to work here.


texts: Managing multiple versions of files on nodes

texts:
The client needs to be able to upload numerous files to each node. They would like only the new versions of files to be searchable/in the search results and for the previous document versions to be versioned, available on the page but not searchable.

I was thinking of adding a file field type to the content type with unlimited number of values. But I cannot figure out a way to disable the search from searching through the previous version.

Any tips on how to do this would be greatly appreciated.


texts: How to enable jEditable to perform updates?

texts:
I recently installed the jEditable inline content editing module on my Drupal 7 site, as an adjunct to the DataTables module.

We need the ability to perform updates on data presented in a DataTable View. I get an error that it cannot connect to the DB.

Does anyone have experience and success in making this work?

Or is there another module/jquery method I can use that does this?

Note: I cannot perform CRUD from a views interface (hence the name views) this would be a cool option though.


texts: Image module custom image style changes image link

texts:
I am using Drupal 7.32, and I enabled the Image module.

I have created a custom "Image Style" so that I could add Bootstrap 3 "img-responsive" class to my image in my view, but adding that custom style to the image field for my view causes Drupal to change the URL where the image is placed and then not resolve the image.

This is the "Image" styles user interface. Notice at the bottom I added my own custom style.

This is is my custom image style definition.

This is my Image field in my view. Here I set the Image style to my custom Image style that I created.

This is the view displaying the content for that view. It is not resolving the images because it is changing the title to http://localhost/system/files/styles/center_block_responsive_image/private/images_content/news/latin.america.night_.jpg?itok=1yvjqDtY. This would resolve but it is adding styles/center_block_responsive_image/private to the URL for the image, when the URL should be http://localhost/system/files/images_content/news/latin.america.night_.jpg?itok=1yvjqDtY.

The content type's image field saves the image to the private file system.
Does anyone know why the Image module would rewrite the image like this? I have a default image that I am using for each piece of content.

The image resolves for the default content type, despite the fact that it is also adding styles/center_blow_responsive_image/private to the URL, as in http://localhost/system/files/styles/center_block_responsive_image/private/default_images/elaw.jpg?itok=BpkGqQJ-.

If I change the "Image Style" on the view field back to "none" it retrieves the image just fine.

Does anyone know why the Image module is adding this extra text to the URL which causes it to not resolve properly?


texts: How to change access callback for content create?

texts:
I want to allow each user to create a specific node type only once.I know that I must use hook_menu_alter and change access callback to my own callback function.But using this way Drupal's main access callback is overriden and it will skip permissions defined in permissions page.

Is there a way to call my own access callback after main access callback is called?


texts: Delta values different after saving multi-value field with user_save

texts:
My module loops through a users current groups they belong to (Organic Group), adds them to an array, then after that loop completes, the new group is added and the array is saved to the user via user_save(). It's working, but the delta values are coming back different. It seems to be adding on to this value every time I save a user this way. For example:

$data = array();               //array to hold groups
$i = 0;
foreach($user->og_user_node['und'] as $oldgroup)
{
     $data['og_user_node']['und'][$i]['target_id'] = $oldgroup['target_id'];
     dpm($data);
     dpm($i);
     $i++;
}
$data['og_user_node']['und'][$i]['target_id'] = $groupid;
dpm($data);               // This is correct, deltas are 0,1,2.. etc...
$newuser = user_save($user, $data);
dpm($newuser);            // This comes back with Deltas like 323,324,327 sometimes it skips numbers even within the same save and even if there are only 1 or 2 groups in this field.

It seems to have started at 320 and it's working it's way up every time new groups are added to the user. If it was incrementing from my testing, I've only added this user to maybe 10-11 groups, so I can't imagine where this value is coming from.

Like I said, this is correctly adding the user to the new group and keeping their old memberships, I just worry this may cause an issue somewhere else now having 'correct' Delta values.


texts: How to restrict node view to users by registration date?

texts:
In short I'm trying to find a solution to:

Restrict view access to certain custom node types by the date the
user registered
The user would be able to see restricted content created in
the month they registered and any future month while their user
account is active, but nothing before the date the account was created
There is existing content restrictions and
functionality for the same users on the same content. Only certain
roles can see selected node types and this is selected when the user
is created (manually). This is managed by
https://www.drupal.org/project/nodeaccess

This website has restricted content that only members (registered users) can see.

These fall into several categories and the content is divided into these categories too.  Depending on the type of member and what you been given access too, you will only be able to see that content. This is managed by Node Access and works well and as intended.

A new requirement has now popped up after the fact where this content access should be further restricted. It should honour the previously mentioned restrictions managed by nodeaccess but now apply additional parameters.  All these are relevant to the month in which the user's account is created:

Restricted content posted before must not be available
Restricted content posted after must be available (and future
content too, but still honouring the nodeaccess restrictions)

I'm fairly capable with Drupal dev, but cannot write code or rules which I think this requirement is leaning towards.

Anyone got any suggestion that will work or can perhaps point me in the right direction to get a start?


texts:
How to insert these additional menu items programatically into the main menu?

In desktop view i have placed these icons by creating seprate block and placed it into twig template just after main navigation menu into the same div,but in mobile menu this icon block is rendering out side the main menu ,i just want to create such mobile menu when user click on it a menu should open along with these icons.

How do I create menu links programmatically?

I am following the above link i think this will solve my issue but i am not able to figuring out where to put this code.

I have to create a custom module or something else that is not mentioned in the above link.

I am not able find any way to render these icons in mobile menu, i am using bootstrap menu.


texts: Quiz Certificate doesn't show quiz results tokens

texts:
I am building a new website to replace a Drupal 7 website that has an online training platform using quiz, quiz_certificate and certificate and a custom content type called syllabus. The website also uses panels and interjections of custom php, both of which I am not interested in doing.

We need to display the date that a user passed the quiz and earned the certificate, this is of utmost important as our users return on a regular basis to earn the same certificate. The previous dev used a current date token so that whenever they download a certificate, it has the current date on it and not the date of when they passed the quiz.

I am wondering if it can't display tokens related to user's quiz results because I am using it incorrectly or it's not designed to do that, and if not then I am wondering what Certificate is supposed do when it is used with Quiz. The token for the time the quiz was passed or ended should be end_time.

Furthermore, anyone can access a certificate, whether they passed or not unless I block their access to it using a math equation in a view based on their score. They could theoretically just go to our website and construct a certain URL to get the certificate (node/[nid]/certificate). The quiz is set to "award certificate" and the individual quiz nodes are set to "manual".

If it is not possible to get quiz result-based tokens into the certificate, could I build a view that will act like a certificate?

If anyone is interested, the view I build to allow users to access their certificate if they got a passing score but not if they didn't can be downloaded here. The math expression I had to use was to rewrite any non-zero number as "download certificate" with the link and then hide for zero. They get a zero for anything less than passing with abs(([score]+1)-[pass_rate])+(([score]+1)-[pass_rate]).


texts: whats the best way to run 2 sites but use same database with same prefix on Drupal 7?

texts:
basically i want to create a duplicate of the site and place it in a separate folder to the main site on the same domain, and have both sites use the same database, so that if one site changes something it changes on the other site too

basically im gonna be developing on one version of the site, while a designer works on the design and CSS on the other site, but he may also want to edit menu links, blocks etc so he will need to be able to write to the database as admin, once both dev and styling are complete we would copy the theme folder from the designers site in to the dev site and delete the other site and use just one for launch

what would be the best way to do this?


texts: I have a View where i would like to expose filters to permit the user to customize the view output. I know i can use exposed filters but, instead of a drop down (or checkbox/radiobutton of exposed filters) i want to put a list of DIV or LI that, when clicked, can update the view output through ajax. In which way is it possible using Views 3 and Drupal 7?


texts: Change image style in view depending on node type

texts:
I have a view which shows a list of nodes of two different node types. Both have an image field.

Now I would like to have the image style to be different for the two node types.

I can't use hook_views_pre_render(), because then I would change the image style for all the nodes displayed. I also think I can't use a tpl.php file, because then I already have a URL, and can't retrieve another image style URL based on that that URL. Another option would be to define the image field twice in the view, and hide one depending on the node type, but I wouldn't know how to do that.

I'm using Drupal 7.

Any idea I overlooked?


texts: how to delete a node programitically in drupal 6?

texts:
I want to add delete permission for a specific node id programitically. I try calling 'node_delete' but it doesn't work.

how can I do it ?


texts: How to get the valid URL of a Link field from within a Twig template?

texts:
I have a Link field named field_my_link (machine name).

Within a Twig template I can get the link's URL value with this:

{{ node.field_my_link.uri }}

If inside the Link's URL there is an external URL, e.g. http://example.com it works good.

But, if inside the Link's URL there is stored an internal URL, e.g. "/node/11", I get a value like this:

"internal:/node/11"

with the "internal:" prefix.

How can I get the valid URL?

For example, if the link's URL is "http://example.com" I want "http://example.com" (this already works), if the link's URL is "/node/11" I want the relative URL "/node/11", if the link's URL is "<front>" I want the URL "/", etc.

EDIT

I can get the value I want within a PHP preprocess function, using this:

$url = $variables['node']->get('field_my_link')->first()->getUrl();

How can I access the same value within the Twig template?

I know I can do this within the preprocess function:

$variables['my_url'] = $url;

Then access the url within Twig using {{ my_url }}, but I would avoid to write a preprocess function each time I have a link field.


texts: How can I use NID Token with the Insert Module?

texts:
I have setup insert module to upload images in a body field.
I want to set the path for the "FILE DIRECTORY" to the "node id" token but it does not show in the avaliable tokens.

The image field looks like

Browse avaliable tokens looks like

Why isn't the nid token available?


texts: How do I compare fields in a database query?

texts:
Given the query fragment:

$query = $connection->select('mytable', 't');
$query->addField('t', 'myfield1', 'myfield1');
$query->addField('t', 'myfield2', 'myfield2');

I need to add a condition like this:

$query->condition('t.myfield1', 't.myfield2', '=');

But it doesn't seem to work. For comparison, I can use:

$query->condition('t.myfield1', 'banana', '=');

... and that works. But it seems comparing two fields to see if they match does not work? I can write this out in straight SQL code and properly query the database in a console, but can't duplicate in Drupal's database API.

What am I doing wrong?


texts: Render webform node on page callback with view, edit, webform, result tabs

texts:
I have a setup where I direct authorized users to a profile2 page or render a webform to anonymous users, using page callback in hook_menu_alter .

I want the admins to be able to access the webform node along with the tabs on the top (view,edit,results,webform). However when I render using node_view(node_load($nodeid)) the tabs disappear.
I have tried node_load with the "full" option as well and it does not work.

Tabs:

Redirection to the webform node will result in an endless redirect loop.

How do I render the webform node along with the tabs on hook_menu_alter page callback?


texts: Drupal 6 Site Duplication - Looks Like My Theme is Broken

texts:
My goal is to duplicate a Drupal 6 site to a new host, but I am having some problems.

  New host - 198.20.226.199/~paul8226/ -- No name resolution setup yet.
  Old host - www.egcasting.com/

I performed a fresh Drupal 6 install on the new Host Gator account using the same database name, username/password as my existing site (clean URLs worked.) Then I imported the database from the existing site, and copied over sites/default (except settings.php) and all of sites/all. It looks like the site totally functions, except the theme is not styling anything at all.

Google Chrome developer tools is telling me I am missing the below CSS files, both of which are on my file system:

http://198.20.226.199/~paul8226/sites/default/files/css/css_89883be7e51f5fd34095c91a397aee3c.css
http://198.20.226.199/~paul8226/sites/default/files/css/css_6ca651b4b42888393291ef9ea27101fa.css
.
.
.

-rw-rw-r-- 1 paul8226 paul8226 39K May 13 15:57 css_89883be7e51f5fd34095c91a397aee3c.css
-rw-rw-r-- 1 paul8226 paul8226 549 May 13 15:57 css_6ca651b4b42888393291ef9ea27101fa.css

The CSS on the old host is working fine. So far, I have looked at the file, and directory, permissions going all the way up. I also tried turning on and off the CSS compression. Turning off CSS compression made the site styling look totally off in another way. When I look at the themes option, it looks like the custom theme I am trying to copy over is having some serious issues:

Broken Theme

Working Theme

I also looked through the theme permissions, and they look like what I think they should be.

 # pwd
 /home/paul8226/public_html/sites/all/themes
drwx--x--x 4 paul8226 paul8226 4.0K Aug 25  2009 eg_prod/
.
.
.
# cd eg_prod
# ls -laSh
total 260K
-rw-r--r-- 1 paul8226 paul8226  42K May 13  2009 theme-settings.php
-rw-r--r-- 1 paul8226 paul8226  37K Sep  9  2009 style.css
-rw-r--r-- 1 paul8226 paul8226  32K Aug 21  2009 template.php
-rw-r--r-- 1 paul8226 paul8226  15K Apr 23  2006 LICENSE.txt
-rw-r--r-- 1 paul8226 paul8226 7.8K Apr 20  2009 style-rtl.css

Thank you very much for taking the time to help me with this. Normally this 'thanks' section gets edited out, but oh well. Thanks!


texts: Drupal 7 - Trying to get term reference node, from html.tpl

texts:
I am trying to access the value of a term reference (field_test), from a node, in html.tpl.

First I need to load a specific node, check if the term reference of this node is the same as another value that i have already in the page.

Is someone knows how to access that term reference, with ne $node object?

I have get already the $node, but i cannot access the "field_test" which is inside the $node.

Thanks

emb


texts: Complete clueless how does Facebook OAuth (FBOAuth) work

texts:
I follow this video to get my Facebook App Id and secret :https://www.youtube.com/watch?v=wyDXlSUHaE8

Drupal module: https://www.drupal.org/project/fboauth

In the setting I added Facebook App Id and secret

In block: I add in my content page.

When I click on Facebook logo and I manage to register.

As a result, I receive this error.

After that this error message appear as well.
The account with username example and email example@gmail.com is not yet activated.

I not sure do I need to continues change setting in Facebook App or I need to do any setting in drupal. Need help.

Many thanks


texts: SMTP module - "Unable to send e-mail..." and "A test e-mail has been sent..."

texts:
I am using the SMTP module (7.x-1.0) on Drupal 7. The site is hosted on a cloud server on which I've installed LAMP. My SMTP config settings are:

SMTP server:  smtp.gmail.com
SMTP port:  465
Use encrypted protocol:  SSL
Username: example@gmail.com
Password: [password]
E-mail from address: example@gmail.com

When I try to send a test email, I get two messages and an error in the "Reports > Recent log messages":

A test e-mail has been sent to example@gmail.com. You may want to check the logs for any error messages.
Unable to send e-mail. Contact the site administrator if the problem persists.
Error sending e-mail (from example@gmail.com to example@gmail.com).

The email is NOT sent. However, the email appears in "Reports > Maillog" (Maillog module).

There is an error in /var/log/apache2/error.log:

  sh: 1: /usr/sbin/sendmail: not found

Update/Edit:

I was under the impression that the SMTP module avoids the need for
Sendmail.I thought, the whole point was that it uses an external SMTP
server. I found the following issue by the way:
drupal.org/node/1078106.


texts: Translate was disallowed for HTML input in a view- how to enable?

texts:
I have created a custom field in view and I want to translate it but the Drupal prevent me,
It shows this error

How I can resolve this problem?
I used Drupal 7.7


texts: How to add content of nested terms to Taxonomy term View

texts:
By default Drupal 8 taxonomy view doesn't show the nodes of child taxonomy terms. I need to include them but don't know to to modify the view Taxonomy term (Content).

I have the following vocabulary:

- Europe
  - Portugal
    - Lisbon
    - Porto
  - Spain
    - Barcelona
    - Madrid

Showing all the content related to cities works fine (for example Barcelona). But now I want to show a list of content for countries (for example Spain) which should include content tagged as city (Barcelona and Madrid). And the same with continents, a list for Europe should include content tagged as Lisbon, Porto, Barcelona, Madrid, etc.


texts: Permission for translating menu items via the menu config screen

texts:
I have a multi language Drupal site, Using i18n and the entity translation approach. Translating menu items from an node works well, but not all the menu items are driven by the nodes.

Now as user/1, I have permission to translate any menu item from the menu config screen:
/admin/structure/menu/manage/main-menu. I am trying to enable the same permissions for other roles/users. The second role has permissions to administer menu items and translate all entities, but for the life of me I cant figure out why the translate link doesn't show in the menu config screen for the other role. Any pointers would be greatly appreciated!


texts: LinkItem: how to create a disabled / null link

texts:
How do I create a LinkItem that will render into

Do nothing

or another form of unclickable link?

Motivation:

I am implementing a computed field of type link, which under some circumstances should become disabled. The HTML attribute disabled is not sufficient.

Code:

if ($disabled) {
  $url = 'internal:#'; # want: 'javascript:void(0)';
  $attributes = ['class' => 'btn btn-danger', 'disabled' => ''];
  $title = t('Disabled');
}

$field_item_list->createItem(0, array(
  'uri' => $url,
  'title' => $title,
  'options' => ['attributes' => $attributes],
));


texts: storing value in session with ctools wizard

texts:
I have created a multi-step form using Ctools wizard and its working fine.

In multi step form, there is only images, so user will select the image and click on "Continue" button for next step. In the final step, I am showing the result of merged images which are selected in all previous step.

Images are rendering as ajax link in each step and when user click on any image, an ajax callback be executed.

In each step form load and ajax callback, fid of the images be stored in $_SESSION variable.

But the problem is that $_SESSION are not updating on the ajax call.

Suppose, there are five images in step 1 in the Ctools multi step form. When step 1 load, I am storing fid of first image into $_SESSION variable and If user click on any images, I am updating the fid in $_SESSION variable.

But, if I check print_r($_SESSION) in next step, its not showing the updated fid. Its only showing fid of the first image in previous step.

If I check ajax callback in fire bug console, its showing correct value of fid and $_SESSION variable.

Please suggest me what I am doing wrong.

Thanks in advance.


texts: Lost access to permissions checkboxes at admin/config/group/permissions/node/

texts:
Not sure what happened. I'm using Drupal 7.15 and the latest OG dev version (2.x) and for some reason, I lost access to all permissions checkboxes at admin/config/group/permissions/node/ - It's not even showing them in read-only mode, they are just not there.

I do have OG access control and field access modules enabled and I haven't done much but trying to create a new group and new content.

Rebuilding permissions or uninstalling the modules completely didn't help.

Any idea?


texts: How to check if a term has a published content associated with it?

texts:
I have taxonomy term list called clients. I have managed to list all the terms on the taxonomy term list page by adding contents for each term, some contents are published some are not.
what I want to do is check and remove the term page link for those terms whose contents are not published and display them without the link.


texts:
I was wondering, is there already a module making it possible to make inline or sidenotes/comments inside the content of a node. A good example is the notes you can add in Google Docs.

Would be great for editorial purposes!


texts:
I have setup a site where users can register as a certain type of user. Once registered, an organic group node is created for them and they can then invite other users into their group.

Can anyone advice me how the group owner and the invited members to automatically login to the group page and how to restrict users to a single group?


texts:
How can I login to my Drupal in API way and use the rest ws module with API calls?

For example, I have a user with name test. I want to login with test user then use API calls with something like a token or identity (I don't know what) and make Drupal recognize user in :

global $user;

How is it possible?

I tried to post username and password to /user/login path  and get token from /restws/session/token

It returns something like this :

emGevPKZl9aLe90tOJ1ZK9rnp--6BMeNV3RP27aqcsY

but when I use it in header parameters with name X-CSRF-Token it does nothing.


texts:
<?php
/*
** Implements hook_menu().
*/
function custom_register_menu() {
    $items = array();
    $items['custom-register'] = array(
    'title' => 'Custom register',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('custom_register_form'),
    'access arguments' => array('access content'),
  );
    return $items;
}
/*
** Implements hook_form().
*/
function custom_register_form($form, &$form_state) {
  // Display page 2 if $form_state['page_num'] == 2
  if (!empty($form_state['page_num']) && $form_state['page_num'] == 2) {
    return custom_register_page_two($form, $form_state);
  }
  // Otherwise we build page 1.
  $form_state['page_num'] = 1;
  $form['egn'] = array(
    '#type' => 'textfield',
    '#title' => t('EGN'),
    '#size' => 20,
    '#maxlength' => 10,
    '#required' => TRUE,
  );
  $form['last_digits'] = array(
    '#type' => 'textfield',
    '#size' => 20,
    '#maxlength' => 4,
    '#title' => t('Last digits from the card '),
    '#required' => TRUE,
  );
  $form['authorization_code'] = array(
       '#type' => 'textfield',
     '#size' => 20,
     '#maxlength' => 6,
     '#title' => t('Authorization code'),
     '#required' => TRUE,
  );
  $form['transcation_date'] = array(
       '#type' => 'textfield',
     '#size' => 20,
     '#title' => t('Transaction date'),
     '#required' => TRUE,
  );
  $form['next'] = array(
    '#type' => 'submit',
    '#value' => t('Forward>'),
    '#submit' => array('custom_register_next_submit'),
    '#validate' => array('custom_register_next_validate'),
  );
  //dsm($form_state);
  return $form;
}
/**
* Validate handler for the next button on first page.
*/
function custom_register_next_validate($form, &$form_state) {
    if(!is_numeric($form_state['values']['egn'])) {
        form_set_error('egn', t('Please enter only numbers!'));
    }
    $egn_length = strlen($form_state['values']['egn']);
    if($egn_length == 10) {
    }  else {
        form_set_error('egn', t('Please insert proper ЕГН'));
    }
    if(!is_numeric($form_state['values']['last_digits'])) {
        form_set_error('last_digits', t('Please enter only digits!'));
    }
    $last_digits_length = strlen($form_state['values']['last_digits']);
    if($last_digits_length == 4) {
    }  else {
        form_set_error('last_digits', t('Please enter 4 digits!'));
    }
    $authorization_code_length = strlen($form_state['values']['authorization_code']);
    if($authorization_code_length == 6) {
    }  else {
        form_set_error('authorization_code', t('Please enter 6 digits!'));
    }

I'm building a multistep form for custom registration on Drupal 7.
The reason that I don't use hook_form_alter is because later I have to create a submit handler to a webservice and other database, but I'll open a new thread later for that.

This is a part of my code (sorry about putting text the down bellow, but drupal.stackexhange is not so friendly for putting text and codes) and you can see that I've created a menu page (custom-register).
On that page there are four fields with custom validators and next button. On the next step it should be displayed the Drupal four fields (username, password, password repeat and email) and after that it should redirect to some register successful message page.

My questions are:

How can I redirect /custom-register to user/register page? I've read about hook_form_alter, but I didn't find a way how to override user/register page.
For the second step of the form after submitting how can I create a new user like on the core user module?

EDIT:

I've managed to alter the default register form with my new form created. :) This is the code:

<?php

    function custom_register_menu_alter(&$items) {
        $items['user/register']['page arguments'] = array('custom_register_form');
        return $items;

    }

Now the next thing is to create the 4 fields (username, password, password repeat and email) and to find a right submit handler to save the user.


texts:
I want to programmatically empty the cart after these events.

Add to cart
Update quantity (in cart page)

In fact users must have only one product in their cart.


texts:
I know the query I am trying to achieve. But how to start create it in views using drupal 7 alludes me. This is what I am trying to achieve

SELECT * from Articles where Node IS NOT current Node.


texts: Updating modules with drush without breaking SVN?

texts:
Right, this has been breaking me for two days. I can't get an answer anywhere!

I have drush 4.4 on my server. I am using SVN via Unfuddle.com. I have a site, I want to update a lot of modules. I want to update just the code, then check it's working (DB updates are not a concern at this point) then commit the relevant code.

It used to be that drush dl  would simply download the module code over the top of the old module, without removing it. That is no longer the case. Now, AFAICT, drush removes the module directory and replaces it with the newer version. That's all well and good, because it solves the problem of old files that are no longer in the updated module being left behind.

However, using the drush dl or upc commands, I am stuck, because running these commands does indeed get the newer version, but it destroys the SVN data folder in the process, leaving me with "! module/file.php" problems everywhere for files that aren't there any more.

I have been advised that "drush upc/dl modulename --version-control=svn" should work, but it doesn't. The SVN data is still destroyed.

This leaves me with the potential nightmare of having to:
svn del module,
svn commit -m"Removed module",
drush dl module,
(test the module),
svn add module,
svn commit -m"Added module" -
for every single module, which is a total horror.

I do not want to set up drush to auto-commit my changes, I just want to download them and commit them all manually at the end when I'm happy with the changes. This can't be that hard, but I simply cannot get it to work.

I have also been advised that moving to git (yes, I'm aware unfuddle supports git!) is also a solution, but it's not an immediate one, and is not satisfactory at this point in time.

Can anyone please shed some light on this?!


texts: How do I override the Bootstrap3 user registration form?

texts:
I am trying to override the default user registration form (user_register_form). I would like for the form to create a CCK node (membership_request) that is already on the system. I am able to get all of the hook overrides setup correctly but I can not get the fields of the CCK form to show up.

Here is what I have done so far:

sites/all/themes/bootstrap/includes/registry.inc

 $hooks['membership_request_node_form'] = array(
        'render element' => 'form',
        'path' => drupal_get_path('theme', 'bootstrap') . '/templates/forms',
        'template' => 'node--membership-request-form',
        'arguments' => array('form' => NULL),
        'preprocess functions' => array(
                'bootstrap_preprocess_membership_request_node_form'
        )
  );

sites/all/themes/bootstrap/template.php

function bootstrap_preprocess_membership_request_node_form(&$vars) {
    //$args = func_get_args();
    //array_shift($args);
    //$form_state['build_info']['args'] = $args;
    //$vars['form'] = drupal_build_form('membership_request_node_form', $form_state['build_info']['args']);
    //$vars['form'] = drupal_build_form('membership_request_node_form', membership_request_node_form(array()));
    $vars['intro_text'] = t('This is my super awesome reg form');
}

sites/all/themes/bootstrap/templates/forms/node--membership-request-form.tpl.php

<?php
print $intro_text;
//print drupal_render_children($form);
?>

In the below examples, "This is my super awesome reg form" will show up as expected  in the new registration form. However, 1) all attempts to pass the form from the preprocess function have failed for me (as shown with the commented lines in the template.php file) 2) when the drupal_render_children line is uncommented in the tpl file I get the following errors:

Thanks


texts: Rewrite rules for Development & Production Environments

texts:
I'm having trouble with the file path when I upload my development environment to the server.

The problem is actually quite simple.
Development is working on the root folder ( development.tld )
Production  is working on the sub-folder ( production.tld/sub-folder )

When I manually add a image in node content on the development environment, the path to that file is /sites/default/files/test.jpg

That path will not work in the production environment because of the sub-folder.

Sample node content:

RewriteBase /sub-folder method works properly in general but I need to remap requests for the manually added assets
( /sites/default/files/* to /sub-folder/sites/default/files/* )

Is there a Rewrite rules for this process?

Thank you.


texts:
I have this page where I've put block views on it but I can't seem to remove it. It's not in the menu items.

I don't know what to show you here, so please if you need screenshots ask me.

Examples:

Ex 1

Ex 2


texts:
file module

Update #8700
•Failed: Drupal\Core\Field\FieldException: Field storage definition for 'type' could not be found. in Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema->getEntitySchema() (line 979 of /var/www/xxxxxxx.com/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php).

This message is shown after running update.php
I believe this is also related to a brand new problem we're having since the upgrade to 8.9.7 -- we can no longer add images.
Need advice for how to perform this update. At this point I just want it done, so even if I have to manually hack something I'm fine with that. I can revisit how to fix things properly once the site is working again.


texts: How do I hide the display of a field if another field is set?

texts:
I have a content type with a date field. The date is mandatory, but I want the option to not show the date in all displays if the option is selected. This date field is not published date.

The content type has several display modes, so I want to disable this in all of them. What would be the best way?

My thought is to add an additional boolean field, "Hide date", but then I'm not sure what is a nice clean way to hide the date field everywhere if "Hide date" is selected.


texts: entity_query: sort: Column not found: Unknown column 'membership__field_year.field_year_value'

texts:
I am using a entity_query, where I get a fatal error because the sort field is not found. The integer field (field_year exists) and exists in the database in the membership__field_year table in the field_year_value row.

query = $this->entity_query->get('membership');
$query->condition('field_membership_member', $this->member->id());
$query->condition('status', 1);
$query->sort('field_year' , 'DESC');

This is the error I get:

  Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'membership__field_year.field_year_value' in 'field list'

How do I sort on an integer field?


texts:
I have a quick tabs on my homepage. When the tabs are clicked the url of homepage changed to like this:

http://www.example.com/home?qt-homepage_tab_menu=0#qt-homepage_tab_menu . . . What should I do if I want to have http://www.example.com/homepage when any tab is clicked?


texts: Looking for suggestions on how to subscribe to a login (I know I can use hook_user_login) when it's not "traditional". What I'm really looking for is to subscribe to anytime a user gets logged in via $ drush uli. Is there any way to tell HOW the user logged in?


texts: How to remove the size attributes of all fields?

texts:
Size attributes just get in the way of responsive forms, and I realize most form fields can be overridden by CSS, but field types like input[type="file"] still do not behave well if a size attribute is set.

See this JSFiddle example.

Since field elements are classed out well, I'd much rather purely rely on CSS for field sizes. So, how can size attributes be removed from all fields?


texts: I am looking for a way to use Mootools with Drupal 6, without disabling jQuery, of course.


texts: I'm suddenly getting the error :EntityMetadataWrapperException

texts:
I'm running a Drupal 7.21 site that uses the Entity Reference module (v.7.x-1.0) to support reusing image nodes in other node types. After several months of smooth sailing , I'm seeing a new error when I try to view image nodes on my site. The error is:

  EntityMetadataWrapperException: Unknown data property
  field_entity_image. in EntityStructureWrapper->getPropertyInfo()

The property named in the error, "field_entity_image", is the name of an Entity Reference field that exists on other node types (article, basic page). However, those other content types don't throw the error when I try to view them. What is new is the fact that I created a new node type (bio) that also uses the existing field_entity_image field.

I've seen this error discussed in relation to certain modules (Commerce being one) but not as the result of creating new content type or adding entity reference fields. If anyone has insights into this, all help will be much appreciated.