texts: Avoid user to multiple purchase of same product

texts: I would like avoid a user to buy the same product twice or more, I'm not speaking about the quantity limitation during the checkout (I've already set quantity to 1 for every purchase)...for example..after a user has bought a product(He has completed the checkout process) I want that he can't buy again this product. Could you help me? Thank you in advance!


texts: How do I add a favicon to my custom theme?

texts: This seems like a simple question, but I couldn't find a clear answer when I googled so going to create one.


texts: Filter date from current date to upcoming 7 days?

texts:
I have a week type calendar view. It currently displays form SUN to SAT of the current week.

But I need to display it starting from current date to current date + 7 days

How can I achieve this?.  I am using Calendar Module and created a view using it.

My view is displayed only if I add a contextual filter. With default value as current date. This adds a filter criteria from dates starting from the start of the week and end of the week.


texts: Per entity settings storage (configuration / state / field)

texts:
Background : #2833770 : Save user configs to states

Auto-logout saves the per-user settings using configuration API, which would obviously break with environment change and config deployment.

The suggested patch moves the storage from the config API to state API. My take on this and from the documentation of State API:

State API is a better alternative which will avoid the deployment issues, but isn't perfect as the state can anytime be reset.
The per-content configuration would get lost once that happens.

How often can a state API be reset? I would prefer some examples other than docs.

As an alternative, I think it would be safe to save the settings in a field on the user entity, but I would like to go this route only if state API is not a good option. I would really appreciate any input on the same.


texts: Display a message during form submission and prevent multiple submissions

texts: During a form submit I would like to display a message that the server is busy processing the submission. In some cases a user has to wait for several seconds. This message should disappear automatically and submitting the form again should be prevented.


texts:
I want to embed the video as follows. I have written a FieldFormatter for this.

public function viewElements(FieldItemListInterface $items, $langcode) {
    $element = [];

    foreach ($items as $delta => $item) {
      // Render each element as markup.
        $target_id = $item->getValue()['target_id'];

        $file = \Drupal\file\Entity\File::load($target_id); //load the file and its attribute.
        $parts = pathinfo($file->getFileUri());
        $new_filename = $parts['filename'] . '_' . $file->getCreatedTime() .'_selfhelpvideofid_' . $target_id . '.' . $parts['extension'];

        $video = '<video width="480" height="320" controls="controls">
                    <source src="movie.mp4"  type="video/mp4">
                  </video>';

      $element[$delta] = [
        '#type' => 'markup',
        '#markup' => $video,
      ];
    }

    return $element;
  }

The above is not working. Please help.


texts: add content reference to product in drupal commerce

texts:
how can I add content reference to commerce product?
consider your product is mobile phone, and you don't want to enter add specifications of the phone, just make content type of phone, make phone contents and reference them in product.
is there a better way? because I couldn't reference content in product.


texts: Searching users with taxonomy terms with search module

texts:
I have search set up with display suite to search user profiles and it works great for titles, bodies.  However I have taxonomy terms attached to the profiles but when I put the taxonomy term in the search nothing comes up.

I understand that search by taxonomy can be done by views exposed filters, and I have that implemented for one area of the site already.

What I need is for searching a taxonomy term in the default search bar to show users that have that taxonomy term on their profile.  I DO NOT want to have a separate search field with a view just to search by taxonomy term.

Is there a way to do this with search-api?  If so what sort of configuration must I do to get this to work?


texts: Problems upgrading drush from 5.10.0 to drush 7 on Ubuntu

texts:
I'm trying to upgrade my drush install on my local ubuntu machine but when I type in 'composer global require drush/drush:dev-master' I get the following error:

Changed current directory to /home/lupiyardo/.composer
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for drush/drush dev-master -> satisfiable
 by drush/drush[dev-master].
    - drush/drush dev-master requires codegyre/robo ~1.0.0-beta1 ->
satisfiable by codegyre/robo[1.0.0-beta1] but these conflict with your
requirements or minimum-stability.
Installation failed, reverting ./composer.json to its original content.

Ok, so I determined it meant I didn't have codegyre/robo. I was sent to this help document. I tried running composer require drush/drush:~8 and it seems to install it fine. However, after doing so when I run drush status it still shows drush version 5.10.0 as the current version.

I also tried installing codegyre/robo, like so:

composer require codegyre/robo:~1

But then I get this error:

./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested package codegyre/robo ~1 is satisfiable by
codegyre/robo[1.0.0-beta1, 1.x-dev] but these conflict with your
requirements or minimum-stability.

Installation failed, reverting ./composer.json to its original
content.

So I'm still stuck. Perhaps I need to fix my composer.json file but I'm not sure how to do that...

So I edited my composer.json file and removed everything in there under 'require' and then ran: sudo composer global require drush/drush:8.1.2

That gave me even more errors:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Can only install one of: pear/console_table[v1.3.0, 1.2.1].
    - Can only install one of: pear/console_table[v1.3.0, v1.2.1].
    - Can only install one of: pear/console_table[v1.3.0, 1.2.1].
    - drush/drush 8.1.2 requires pear/console_table ~1.3.0 -> satisfiable
    by pear/console_table[v1.3.0].
    - Installation request for drush/drush 8.1.2 -> satisfiable by
    drush/drush[8.1.2].
    - Installation request for pear/console_table (locked at 1.2.1) ->
    satisfiable by pear/console_table[1.2.1].

Installation failed, reverting ./composer.json to its original content.


texts: In which order should one build up a multilingual site?

texts:
I'm planning to convert (better rebuild) an existing site based on MediaWiki and a phpBB3 Forum to a shiny new Drupal based site. The MediaWiki is multilingual, though most content is in German.
My experience with Drupal is basic. I've done basic things with other CMSs and am familiar with PHP, MySQL and HTML.

A couple of weeks ago I set up a new Drupal 7.10 instance (locally).
My first try was migrating the existing MediaWiki content as articles into Drupal. I failed badly and could not find a way (on the web) realising this.
I ended up building the central and essential MediaWiki templates (which are very individually) as content templates. That worked pretty satisfying and I accepted to manually copy&paste the content in a later step (has somebody a monkey for me?).

Then I tried migrating the existing phpBB into a Drupal-based forum via a module (failed) and finally agreed on bridging those. The modules for this are actively developed and I let some more time pass as to get them more mature.

Beside those two central topics of the desired Drupal site, multilingual content is essential as well. For the wiki-like content even more than for the message board. In case of the wiki content, the users will be creators of new and translators of existing content.

While trying different ways and different modules for all the functionality, I have to admit, that I got hopelessly lost.
I'm not asking for a specific set of modules, I should use. I would have to define all functionality of the desired Drupal site and that's not the core of this question.

My question is rather: In what order should I build up the site's functionality?
That is, after having set and defined the access and user groups, should I first concentrate on the multilingual backend and translation pipeline (e.g. modules for multilingual content and translation)?
Or should I first get the templates for the wiki-based content right and implement the multilingual thing atop of that?
Both is somehow closely interconnected and -- as mentioned above -- I got lost while finding my own way.

I hope, this question is not too broad and vague. If so, please let me know and I try even harder getting it more specific.


texts: MySQL Error: Duplicate Entry on indexing taxonomy structure with Search API

texts:
Problem

I have a search index. I use a views page with this to create a search page and results for users.

I was forced to re-create my search index. I deleted the old one and I'm getting the following error when I attempt to index the new one after re-creating it.

(Technically I get 49 errors, one for each piece of content i'm trying to re-index)

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '632' for key 'PRIMARY'

I only get this error if I attempt to index the hierarchy of a particular taxonomy field.

It sounds like it's trying to re-generate the ID for my set of items, but even uninstalling and re-installing the module and re-creating everything doesn't clear the error.

Any ideas about what might be causing it? Or what I should look for in MySQL as I dig through tables?


texts: Using Media, views, and colorbox to create a image gallery

texts:
Currently I am running in D7 with the following modules:

Media 7.x-2.0
Views 7.x-3.7
Colorbox 7.x-2.4

I am trying to create an image gallery using these modules with the following steps. Please note problems I am running into will be in bold.

Go to admin/structure/views
Click Add new view
Select File for show, and image for type
Unchecked Create a page, and check Create a block
Select Grid of File for Display Format
Click Continue and Edit

This is where things go off the rails for me, what I would like to do is have ALL images that are tagged display in a custom image style I already created (200x200) in a 4 column grid, and when you click on them they open up into a normal sized image colorbox.

Now I have seen this done when you create a image content type, but that way is clunky compared to using the media module, and I have to believe that there is an easy way to do this with these modules, and I am simply missing it.

I have read about Media Gallery module, but there seem to be a lot of errors with it and I am not thrilled with the idea of it.

Any help on how to get what I am trying to do done would be greatly appreciated as this is becoming a bother.


texts: Changing the order used to show the weekdays

texts:
I have installed the event calendar module.

The problem that I have is that the calendar block outputs as follows:

  S M T W T F S

where I would like it to be outputted as follows:

  M T W T F S S

I've tried looking at other sources but I cannot seem to find a solution.

Can anyone offer a solution?

Thanks in advance.


texts: isotope Combination filters with the Views Isotope Module?

texts:
Here is a link to the proof of concept: http://isotope.metafizzy.co/demos/combination-filters.html

So we know it is possible with Isotope. How do i accomplish this with the Views Isotope module?

I currently have two main Taxonomy, Genre and Style.  I am filtering by Style but also want to filter by Genre. Fore example, Genre 'Hip hop' with a 'West Coast' Style. Or 'R&B' Genre with a 'Soul' Style.

Any ideas how to do this?

Edit: there is this blog post explaining Views Isotope and they have a paragraph that talks about this but it makes no sense to me. Might help someone answer this: http://acrl.ala.org/techconnect/?p=3739

  "There are two obstacles to using this feature in a more widespread
  manner throughout the site.  First, I have only recently figured out
  how to implement multiple filter options.  For example, we might want
  to filter our news stories by Discipline and Semester.  To do this, we
  rewrite the sorting fields in our Grid display so that they all
  display in one field.  Then, we create two Filter blocks, one for each
  set of terms.  Implementing this across the site so that users can
  sort by say, item type and vocabulary term, will make it more useful
  to us."


texts: Weird redirect on taxonomy term edit page

texts:
When I try to edit taxonomy terms, or delete them, and I click on edit/delete,  it redirects me to that term page instead.

I also have Devel module installed, and when I choose that option in the drop-down menu, it works.

I have tried almost everything.

URLs are OK; if I inspect the edit/delete buttons, the URL is the expected one. When it redirects me, that URL remains in the browser.
I thought it was a Drupal core issue. At the time I was using Drupal 8.5.3, but I am still having the problem after updating to Drupal 8.5.5.
I have removed all my custom modules/theme files (to check if it were my fault).
I changed the administrative theme from the Seven theme to the Bartik theme.
I cleared the cache and ran update.php several times.

The problem still remains, and I'm still not sure if it's an issue I have somehow caused, or it's a Drupal core issue.

Did anyone have a similar problem, or know what would be the problem?


texts:
How to make a video responsive using the Media:vimeo and Media:youtube modules?

I read somewhere to add some css:

.file-video-vimeo{
  padding-top:56.25%; /*16:9 aspect ratio*/
  position:relative;
}

.media-vimeo-video{
  position:absolute;
  top:0;
  left:0;
  right:0;
  bottom:0;
}

..and to set both width and height to 100% in the video display settings.

However, this does not work for me, it does not show full width of its container.

I see in my page html that for the vimeo player,
vp-player-layout js-playerLayout
has

left: 40px;
    right: 40px;
    top: 0px;
    bottom: 0px;

Why is this? This causes the video not to be the full width.


texts: drush --quiet cron generates watchdog notices

texts:
We have started using drush cron to manage our basic Drupal sites' scheduled tasks. I set this up using the guide at http://docs.drush.org/en/master/cron/ and it seems to be working well, except that these messages are generated on every run:

 [notice] WD Periodic: No periodic processes to run.
 [notice] WD cron: Cron run completed.

despite passing the --quiet option.

Is there a way to silence this output while still being made aware of any issues that come up with the cron task in future? We can redirect these two lines to standard out and filter on them but I wanted to find out if there is something about our Drupal setup that is causing the lines to be generated.

Our cron line is almost identical to the one in the article, but for the sake of completeness I've included it below:

0 * * * * apache /usr/bin/env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin COLUMNS=72 /bin/drush --root=/path/to/our/drupal/site --uri=our.drupal.url --quiet cron

The drush version is 9.0-dev. Drupal version is 7.50.

Thanks for any suggestions you can provide.


texts: How to hide non-editable profile fields in DrupalGap?

texts:
In the Drupalgap user profile there is a field that should be viewable, but not be editable by the user. I am using field permissions and the permissions are respected - the user cannot change/save/update the value.

But the field is shown in the edit view of the profile a looks editable. Is this intended?

How can I hide the field in the edit user view? Is targeting the specific field(s) individually with hook_form_alter the best way?

/**
* Implements hook_form_alter().
*/

function my_module_form_alter(form, form_state, form_id){
 try {

console.log("Form ID " + form_id); // Use to see the form id.
console.log("FORM: " + JSON.stringify(form));    // Use to inspect the form.

if (form_id == 'user_profile_form') {
   $('#edit-user-profile-form-field-points-und-0-value').css("background-color","yellow"); // not working
   $('#edit-user-profile-form-field-points').css("background-color","yellow"); //not working
   $('#edit-user-profile-form-field-points-und-0-value').hide(); //not working

// not working from: https://www.drupal.org/node/2170427:
 form.elements.edit-user-profile-form-field-points-und-0-value = {
 // type: 'textfield',
 // title: 'My Text Fied',
  options: {
    attributes: {
      disabled: 'disabled'
    }
  },
  access: false /* use this to completely hide the form element */
};

console.log("this is user_profile_form");
}
}
 catch (error) { console.log('my_module_form_alter - ' + error); }
}


texts: How to update the uid of a node in node revision table?

texts:
Is there any way to update the node's uid in the node revision table using rules.

I have used the node:author but it only update the uid in the node table and does not update in the node revision table.

Is there any other way?


texts: How do I modify a menu link title dynamically?

texts:
This seems so simple, there -must- be a way, right?

I want to modify the title of a menu link dynamically. I've tried the techniques in this question:

Change menu link title dynamically?

...The last one ( using menu_token() module) seemed promising, but that threw an error when I tried to apply it to the menu item in question.

I also tried the technique here: https://www.drupal.org/node/1538094

...but that only modifies the Page title... not the link of the -menu-.

So I tried the following code, which doesn't appear to do anything (although I am sure that the variable is being assigned.)

Any other ideas? I must be missing something -obvious-, right?

function MY_THEME_preprocess_menu_link(&$variables) {
    if (isset($variables['element']['#original_link']['menu_name'])) {
          if($variables['element']['#original_link']['menu_name'] == 'secondary-navigation') {
        if($variables['element']['#title'] == 'Cart') {
          $new_title = 'Cart(4)'            ;
          $variables['element']['#original_link']['link_title'] = $new_title;
          $variables['element']['#title'] = $new_title;

    }

}

}
}

EDIT: I also tried this:

function MYMODULE_menu_link_alter(&$item) {
    // add in an if statement here to just target the links you want to change on the fly
    $item['options']['alter'] = TRUE;
}

function MYMODULE_translated_menu_link_alter(&$item, $map) {
    if($item['mlid']==1166) {
     // the watchdog fires properly
     watchdog('test', '' . print_r($item, 1) . '');
     $item['link_title'] = 'Cart(x)';
     $item['title'] = 'Cart(x)';
    }
}

...and the above did not work either.

This has gotta be something obvious, right?


texts: Global Filter as main menu drop down link

texts:
I'm looking for right steps to implement Global Filter module not as a block, but rather as an main menu links. The biggest problem is that each user can see only links they have access to (taxonomy access). So it's not possible to make these links static.

I've tried to include a block in the menu link, but that's not what I want.

Has anybody an idea where I could begin?


texts: How to write a service module for Drupal 7 and Services 3.x?

texts:
Can somebody please give instructions on how to write a simple service module for Services 3.x and Drupal 7.x? I simply cannot find any that works with D7. Anything! Just a reworked version of echo_service module would do!

At the very least please link to a working example. Thanks.


texts: D7 how to check does the uploaded photo have EXIF data?

texts:
I'm using Drupal 7 with module EXIF.
I want to check if uploaded photo have EXIF data if not then don't allow the user to add this content.


texts:
I am wondering if there is a way to say have a link under add content which automatically adds a panel layout with certain "options" selected and automatically adds blank custom content slates?

Something that would make it easier for a user editing it to click a single link and not have to type in

Title, Menu Link, save -> click Panel Content -> Add the mini panel top right, add the new custom content top left, add the new custom content middle.

Something that would allow me to click

Add New Article

Fill in title, menu link, click save, and be sent to the panel content area with all the panel content slates already added, you just need to edit them.

Sorry if that is confusing :)


texts: drupal commerce multiple products on one page

texts:
I'm building a website in which people can reserve plays(theater). I'm using a product display for this.

The problem is, a specific 'play' is going on for a number of days, and people should be able to reserve for a specific day.

For example : a specific play might go on the 18th,19th, and 20th of September and customers need to be able to select a date from those available.

How can this be achieved with Drupal Commerce ?

One idea I had was to create multiple products with the specific date, but how do I show multiple products on one product display ?

Thanks.


texts:
I just deleted 25 menu items and it took me some time to do it.

Just wondering if is there any way (module) to bulk delete menu items.


texts: Drupal 7 commerce stripe stripe-php library refuse to load

texts:
I'm trying to implement commerce on my D7 site and after installing packs of modules I've installed commerce_stripe module to use Stripe payments.

After I created all necessary things(stripe account, products, stripe api keys, latest stripe-php library in sites/all/libraries/) I'm trying to proceed payment and see an error:

Error making the payment. Please contact shop admin to proceed.

Went to reports -> recent log messages and see:

Failure to load Stripe API PHP Client Library.

Hours of googling and I found few ways how to handle it. Updated Libraries module to the latest version, instead of 7.x-3.0-alpha installed 7.x-3.x-dev, clear cache, run cron.
Unfortunately, nothing happens.

trying to locate an error I've found function that trying to load stripe php library. It's commerce_stripe_load_library() in commerce_stripe.module file. Error throws in the beginning of this function:

$library = libraries_load('stripe-php');
  if (!$library || empty($library['loaded'])) {
    watchdog('commerce_stripe', 'Failure to load Stripe API PHP Client Library.', array(), WATCHDOG_CRITICAL);
    return FALSE;
  }

Trying to dpm result of libraries_load() function.
and first condition !$library is passed successfully.
But $library['loaded'] is FALSE.

Any ideas why? Any help appreciated.


texts:
I created a custom form in Drupal 8. I remember we can redirect to custom path  in Drupal 7 with $form_state['redirect'] = 'mycustompath'; in a submission handler.
How can I achieve the same in Drupal 8?
I know I should use submitForm().
public function submitForm (array &$form, FormStateInterface $form_state) {
   // Redirect users.
}


texts: How to go from View to Webform, submit Return to View

texts:
User is working a list of names with Views... select a link on the view to open webform, submit the webform.  Then I would like to return the user to the view.. Where he can continue working the list of names.

Hopefully save url to a hidden token in the view (which token is current url?) then send token in the link to webform pre-populating hidden object in webform?
Back button is a bad idea because I don't want to go back to the webform.  I want to return to the View.


texts: Panel frontpage overrides site front page after migration

texts:
I have migrated an old Drupal 6 site to Drupal 8.

On the old site I used a panel page as a front page.

Now on the new site there is no way to change this path.

No matter what I put in the "default front page" form on the "Basic site settings" page the front page keeps linking to the old panel node. And if I delete all panel nodes and the panel module itself I get a 404.

So I'm guessing this is some weird variable stored in the database but I have not been able to locate it. Any ideas?


texts:
This is very strange.

Comments are only displaying for a content type called "Issue" for roles that have the Comment permission "Administer comments and comment settings". I set the "View comments" permission for all roles. All the other content types display the comments properly to all roles. Somehow this content type is corrupted. Has anyone seen behavior like this? Any suggestions on how to fix it?


texts: Checking for User Role in Views Field with Twig

texts:
I'm currently building a view, where different Links should be displayed in a field, based on the currently logged in users role.

I've read a bit into Twig, but haven't found anything similar yet (if it is even possible).


texts:
I have made a hook_node_insert which when I create a group content of type A, it create a node group. I want to associate my type A with the created group with the field audience.
I have changed the field group audience like that

$nodeA->group_audience = array(
    LANGUAGE_NONE => array(
        '0' => array(
            'gid' => $group->gid,
        ),
    ),
);

But it doesn't save the data into the database. I have tested with node_save but I have the error that primary key nid is duplicated.

Thank


texts: Custom contraint validator: show an error message with a link

texts:
We use a custom constraint on a custom entity type. In this entity type we have a string field "url basis" which is used to create aliases for many kinds of pages and data related to this entity.
Therefore it is important that this url basis is unique with every single entity. Here is the constraint:
class UniqueParliamentBasisUrl extends Constraint {
  public $notUniqueURLBasis = 'The basis URL needs to be unqiue but the set basis URL %basisurl is already in use: @parliament_link';
}

In UniqueParliamentBasisUrlValidator->validate() I try the following:
    $link = $parliament_using_basis_url->toLink($parliament_using_basis_url->label(), 'edit-form', ['attributes' => ['target' => '_blank']])->toString();
    $this->context->addViolation($constraint->notUniqueURLBasis, ['%basisurl' => $item->value, '@parliament_link' => $link]);

Here $link becomes the HTML markup for a link so that the user can easily switch to the entity which already uses this url basis in order to edit it. Unfortunately the markup becomes escaped so that the user does not see a clickable link on the form but the markup:
The basis URL needs to be unqiue but the set basis URL bundestag is already in use: Bundestag

Is there a way to add markup to the violation message without being escaped?


texts: how do I make JavaScript run after the page is loaded

texts:
With Drupal 8, I am adding JavaScript to my theme in the libraries.yml so that I can put lift segments into the data layer.  But it is running before the body is loaded, and the data layer is being overwritten.

How can I make this script run after the body load?


texts: Filtering PrivateMsg types by "sent" or "inbox"

texts:
I'm wondering what approach programmatically I should take when displaying message links that are either sent to the user loading the list, or sent out to other users.

Using some modifications to the example code listed at http://drupal.org/node/624528, I've loaded all unread and read messages regardless of author:

foreach ($query->execute() as $key => $thread) {

if ($count <= 25) {
                        // Generate a link with the subject as title that points to the view message page.
                        $items[] = array(
                            'data' => 'thread_id . '">' .
                            '

' .
                            '
' . $username . "
" .
                            '
' . $thread->subject . "
" .
                            '
' . format_date($thread->last_updated, 'short') . "
",
                            'class' => array($class),
                            'id' => $key
                        );
                        $count++;
                    } else {
                        break;
                    }

and the output is done through a theme() call. I'm seeing that messages sent return null in $thread->participant. Would this be a sufficient use case to track for sent messages?


texts: What are the various roles supported by the Group module?

texts:
The Group module is an alternative for Organic Groups. For each group you can specify appropriate permissions, and this for various "roles" that are specific to the Group module (these roles are not the typical/global roles of a typical Drupal site).

Question: what are the various roles supported by the Group module?


texts: Views, Grouping by various levels of granularity in a date field?

texts:
I'd like to group a nodes in a view by date, but more specifically, I'd like Grouping field Nr.1 to be year and Grouping field Nr.2 to be the month.

Possible?

At current the test view looks like this:

I'd like it to look more like this

2015

November

ibh Persto Torqueo Vel

October

Commoveo Macto Premo Vel

September

Ad Adipiscing Meus Nutus Tego Torqueo

2012

December

Antehabeo Decet Pala Populus

April

Quadrum Si Suscipit


texts:
I need to make some checks on node access form based on user/role attributes that cannot be handled by Drupal core modules, so i think to do them in _form_alter hooks.

Which is the best thing to do when the user has not access to the form edit ? I can do a drupal_goto(...) but i would like to stay in the same form, showing an access denied command. How can i do it?


texts: I need to import a new config without some files because when I try to install the profile module it says that profile.type.main, system.action.profile_delete_action, system.action.profile_publish_action, system.action.profile_unpublish_action already exists in the current config and this doesn't allow me to install that module


texts: Content Type and Fields programmatically

texts:
I make a module in Drupal 8 who create a new content type programmatically.
Module name : Annonce

In config/install I add this file:

node.type.annonce_type.yml

type: annonce_type
name: 'Ajouter une annonce'
description: 'Formulaire pour ajouter une annonce'
help: ''
new_revision: false
display_submitted: true
preview_mode: 0
status: true
langcode: fr

All is good, my new content type is create in backoffice.
But now I want to add some fields programmatically, and I don't find a core module who are doing that.


texts:
Can anyone tell me the best way to export blocks from Drupal 6 to 7?

Boxes? Features? A Straight field for filed export?


texts:
I am currently reviewing Drupal 8's security features and was wondering about how Drupal stores user passwords. I know Drupal uses salted hashes to store the password in the database, but does Drupal also store a user's previously used passwords so that they can't reuse them again? If it does, does that list have a hard limit to it (i.e. does it only store the last twenty used passwords before recycling the list)?

I am only interested in the out of the box experience with Drupal 8. I know there are modules that you can use to add extra functionality/security to user passwords but that isn't part of this question.

Thanks.


texts:
In my Drupal 7 template, this one line of code spits out all my menues:

<?php print render($page['header']); ?>

I want to remove extraneous wrapper tags from my menus; for example, Drupal 7 prints out one of my menus as:

Top menu

Membership

Calendar

Newsletter

Contact Us

I want to simplify it to something like:

Membership

Calendar

Newsletter

Contact Us

How do I remove unnecessary wrapper tags?


texts: Alternative themed forms for a single custom content type

texts:
On a site I would like a "quick entry" form for a custom content type on the front page, while also keeping the "normal" non-customized "node/add/mycontenttype" form. I'm able to customize the "normal" form by using the theme_hook function returning the proper array which points to my function that renders the form ('template' => 'some-node-form').

But ideally I would like to keep both versions of the form, rendering my customized form on the frontpage in a block, and with the normal form at the normal place "node/add/mycontenttype". I figured I could try to detect at runtime in the 'some-node-form' function if for instance it was invoked through a special path "node/add/mycontenttype/frontpage", by passing a variable or similar. I haven't quite managed to do this yet, but at least in theory it should be doable.

But do any experienced Drupal developers have better ways of accomplishing what I'm doing, things like having multiple paths pointing to different template rendering functions or similar?


texts: Map generated from custom address fields

texts:
I have a seemingly simple problem, but I've been stuck with it for some time now.

I have a big database of nodes of one content type. There are addresses there made of text fields: one field for street, one for city etc. Province is a predefined taxonomy. I'd like to use 4 of these fields, including province, to get a string that can be geocoded as lat/lon for a map.

I also need these fields to be useable in Views (e.g. as filters like a province filter, as tokens etc.). It is doable in GMaps + Location (Views module recoginzes each locative entry as a separate field), but GMaps is seemingly an obsolete module, and it forces me to use predefined provinces which is not cool.

Also, I need to display a small map when a user displays one of the nodes, and the other for the home page with all the locations marked and ready to get filtered out by exposed filters.

I thought maybe geocoded Field Collection is an option for me, but the separate elements of such a field are strangely not visible in Views module as filtering/sorting criteria. I also tried the Computed Field, but there is a bug which prevents its text output from being geocoded. ( http://drupal.org/node/1679926 -- bug desc.)

Am I missing something? Are there any other simple ways to get a map made of custom fields as address elements?

Regards!


texts: How do I get the password from form API to use to log into external site?

texts:
I have these functions, one is for the Form API and the other, git pull, is called on a cron hook. The password is coming up blank and therefore the git pull is not working.

function cronmonitor_admin_form($form, &$form_state) {

  $form['cronmonitor_account'] = array(
  '#title' => t('Github Account'),
  '#type' => 'textfield',
  '#description' => t('Github ID'),
  '#default_value' =>  variable_get('cronmonitor_account'),
  );

  $form['cronmonitor_pass'] = array(
  '#type' => 'password',
  '#title' => t('Password'),
  '#maxlength' => 64,
  '#size' => 15,
  );
 ...more form elements....
}

function git_pull(){

  $localRoot        = variable_get ...
  $localRepoName    = variable_get ...
  $localRepo        = "{$localRoot}/{$localRepoName}";
  $username         = variable_get('cronmonitor_account');
  $password         = variable_get('cronmonitor_pass');
  $remoteRepoName   = variable_get ...
  $remoteRepo       = "https://{$username}:{$password}@{$remoteRepoName}";
  if( file_exists($localRepo) ) {
      shell_exec("cd {$localRepo} && git pull");
  }
  else {
      shell_exec("git clone {$remoteRepo} {$localRepo} ");
  }
}


texts: Drupal Commerce PayPal Express Checkout review and confirm step is skipped

texts:
User is not seeing Confirm Order Page (Express Checkout review and confirm) during PayPal Express checkout.

  The EC module defines a new checkout page called Confirm order between the payment redirect and completion pages and a checkout pane called Express Checkout review and confirm that should only be used on this special page.

I am using 7.x-2.3 release of Commerce PayPal module. Testing with PayPal Sandbox accounts.

After logging into PayPal customer sees "continue" button and a message *"You're almost done. You will confirm your payment on **'s Test Store."*. After clicking "continue" customer is brought right to the Order Complete page and the payment is registered in the system. Which is not the intended behavior of PayPal EC module.

These are Order history messages that have been recorded during checkout with PayPal express:

Status has been set to Checkout: Complete (previously: Checkout: Confirm order).
Status has been set to Checkout: Confirm order (previously: Checkout: Payment).
Payment of $62.00 submitted via PayPal Express Checkout.
Order has been paid in full.
Status has been set to Checkout: Payment (previously: Checkout: Review).
Status has been set to Checkout: Review (previously: Checkout: Checkout).
Status has been set to Checkout: Checkout (previously: Shopping cart).
Product sample2 added to the cart.
Order has been created.

QUESTION: What could be the reason of why Express checkout review and confirm page is skipped?


texts: Override a node template suggestion with template in custom module

texts:
We have a content type that is added to the drupal system Programmatically when we install one of our custom modules. Essentially the module handle incoming property data from a 3rd party and creates a node entity for each property.

The content type created is named properties and as such its template suggestion shown in Twig debugging is node--properties--full.html.twig, see below:

I am creating a second custom module called lrg_property_display and my intention is that this module will handle all the rendering related functionality as I want to keep the API import related functionality separate from the rendering. My module structure is shown below:

I have created my module and followed a couple sites suggestions that I simply create a template file in my module and in the .module file implement the HOOK_THEME method, which I have done as shown:

function lrg_property_display_theme($existing, $type, $theme, $path)
{
    $theme['node__property_display__full'] = [
        'template' => 'node--property-display--full',
        'base hook' => 'node'
    ];

    return $theme;
}

Clearing cache and refreshing the page though is showing that the theme is not been applied.

Where am I going wrong with this please? I basically need the node--property-display--full.html.twig template within the module to be used whenever a node of the type Properties is viewed.

UPDATE

I added the following code to my theme file (Theme name is white_label) which seemed to produce an error which suggests it 'almost' works, albiet I'd prefer not having to do a suggestion in the theme but want it in the module. I can live with it though if this works for the short/medium term:

function white_label_theme($existing, $type, $theme, $path)
{
    return array(
        'node__properties__full' => array(
            'render element' => 'elements',
            'template' => 'node--property-display--full',
            'base hook' => 'node',
            'path' => drupal_get_path('module', 'lrg_property_display') . '/templates',
        )
    );
}

This then looks for the template node--property-display--full.html.twig but its looking in the main theme directory not in the module, even with the path specification.

The error returned was:

he website encountered an unexpected error. Please try again later.Twig_Error_Loader: Template "themes/custom/white_label/templates/nodes/node--property-display--full.html.twig" is not defined.

Reference image for comment in @Leigh's answer


texts: Which hook or tpl file controls the output of a view (to manipulate the results)?

texts:
I am creating a recurring events views page, but currently the output of my view is displaying multiple references of the same date event. I am also not using Fields as an output, I am using content|teaser.

I have come up with 2 methods of resolving this issue, but wanted to clarify which is best and how to go about it.

Find a hook that outputs the Views rows and then write a conditional to compare each row and delete the duplicates.
Create a tpl file and do a preg_replace() on the views output to delete duplicate rows of the same data.

Now the question is how do i go about finding this hook or what to name the Views tpl file as? I only want it specific to this events page.


texts: User profile picture - avatar uploader on all pages

texts:
I am trying to change my profile picture via ajax.

I used views to display my user profile picture in a block. This works Perfect.
I am then using the avatar uploader module to change my user profile picture.  This module is exactly what I want because it also crops my photos.  The problem is, this works, but only if I am on the user edit page.  I get the ajax uploader if I click on my profile picture that is displayed using views, but only on the user edit page.

Is there any way to get this module to work regardless of what page I am on?

Thanks.


texts:
I'd like to remove the ability to edit/update an entity form once it was been completed and submitted correctly.

I thought there might be a way to lock an entity form? Or remove access? or hide the edit tab.  Any suggestions on how to accomplish this?

Thanks


texts: Undefined property error in custom module

texts:
I am getting errors on specific pages of my drupal site pointing specifically to this line..

if (is_object($argument) && in_array($router_item['page_arguments'][$key]->type, array('article', 'page'))) {

what could be the problem? Here's the complete error and function.

Notice: Undefined property: stdClass::$type in custommodule_menu_local_tasks_alter().

function custommodule_menu_local_tasks_alter(&$data, $router_item, $root_path) {
  foreach ($router_item['page_arguments'] as $key => $argument) {
    if (is_object($argument) && in_array($router_item['page_arguments'][$key]->type, array('article', 'page'))) {
      foreach ($data['tabs'][0]['output'] as $key => $value) {
        if (($value['#link']['path'] == 'node/%/edit'||'node/%/view') && (!user_access('administer nodes'))){
          unset($data['tabs'][0]['output'][$key]);
        }
      }
    }
  }
}

Edit:
There are similar error in following line..

foreach ($data['tabs'][0]['output'] as $key => $value) {

--Notice: Undefined offset: 0 in custommodule_menu_local_tasks_alter() (line 59 of...)
--Warning: Invalid argument supplied for foreach() in custommodule_menu_local_tasks_alter() (line 59 of ...).


texts: Batch update XML Sitemap for content type using VBO - D7

texts:
I am trying to update a portion of my Basic Pages' XML Sitemap setting. By default my Basic Pages are Excluded in the XML Sitemap (what I want), but I want to bulk update only some of them (long story). I can manually go to each of the pages and update them to be Included, but that will be a pain.

I tried to use VBO and I created the filters I want, but there isn't a XML Sitemap update Operation. I can create a Rules Action, but again, I couldn't find integration with the XML Sitemap setting.

Is there a setting for bulk updating the XML Sitemap setting that I'm missing? Or some module that does this already?

Other ideas I have if this functionality doesn't exist:

VBO: Execute arbitrary PHP script & run a Database update
Rules Action: Create a custom action to run a Database update
???

Drupal 7.34, Rules 7.x-2.7, VBO 7.x-3.2, XML Sitemap 7.x-2.2

Thanks.


texts: Override module javascript file in theme or custom module

texts: Is it possible to override a single javascript file from a module within a theme or custom module? My specific use would be for Views/js/ajax_view.js - I've had to apply multiple patches to get ajax views to work properly with BEF and panels, and though I'm including documentation for future developers, it seems more foolproof to override within the theme or a custom module.


texts: Why computed field is not getting displayed while creating content

texts:
I using "computed field" Module. I have installed the 7.x-1.0-beta1 version computed field module. Enabled and save the configuration.

I have created a computed field and just displayed "Hello" in my content type "abc".

But this "computed field is not getting displayed while content creation.

Any ideas why this computed field is not getting displayed.


texts: How to generate XML feed with nested tags using Xpath Parser?

texts:
I have a XML file as below

<rss>
  <channel>
    <title>Channel Title</title>
    <description>Channel Description</description>
    <owner>
      <owner:name>Owner Name</owner:name>
      <owner:email>Owner Name</owner:email>
    </owner>
    <item>
      <title>Item 1 title</title>
      <author>Item 1 author</author>
    </item>
    <item>
      <title>Item 2 title</title>
      <author>Item 2 author</author>
    </item>
  </channel>
</rss>

In my Xpath parser settings, I gave /rss/channel/item as context and I am getting only the item title and item author into my node. How it is possible to add title,description and owner details into my node?. And I also want the same structured XML output using Views data export.


texts: I would like to edit the html produced for a field. Is that possible to do this through a hook? I want to convert "date1 - date2" to "date1 to date2".


texts: D7 Webform custom email template url encoding issue

texts:
I am a newbie in Drupal development, my current project use drupal webform module email functionality to send an email to the recipient and using the custom email template.

The email template has a href link that allows the user to share the tweet, I want to add the  custom tag in the middle of shared text, so I encode the # as %23 in the querystring, however when webform sends out the email, the %23 is always getting decoded, which breaks the tweet content.

Below is the original link I put in my email template

test share

The following output is the decoded version I get from the email source

test share

Can someone advise me how to fix this annoying issue? if that's the webform bug, which hook or function I can use the prevent this decoding issue?

Thanks


texts: How to use Simple FB Connect in decoupled Drupal

texts:
I'm creating a Drupal 8 website which I need to be able to access via Facebook OAuth. The Simple FB Connect module has solved the signup/login issues quite well. Users can sign up to the website with Facebook as intended and it created a Drupal login flow as intended.

But now I also need to use the OAuth procedure I have in place with Drupal, when the client is a native mobile user, ie, Android phone, to use with a decoupled Drupal backend.

Something like, in a mobile app, the user selects "Login with Facebook" and that produces the same effect as using Facebook to login to Drupal, but now to use with REST services.

There is no documentation on the module's docs regarding this use case, so I'm suspecting it might not be possible in a straightforward manner.

Even so, I was wondering if simply sending the user's credentials to the backend and then having the OAuth token going back and forth would be enough. Does anyone have some experience with this use case?


texts: How form layout of user login page can be changed Drupal 7 without altering its tpl file ?

texts: I want to change the layout of user login form in Drupal 7. I don't want to change or create its tpl file for that purpose. Is there any module which will works for me ?


texts:
I have created a form by extending FormBase class. In form, I'm having a field called "name" where user can input his name. While submitting form, I want that submitted name convert into token so that I can use that token sending emails.

example.com/admin/config/people/accounts, here is the Drupal default configuration email forms.

What I want is to use custom form field value to be appear as a token inside drupal default email config forms.How can this be achieved?

Any help is appreciated. Thanks.


texts: Config import constantly showing configs to import

texts:
Recently after doing a config import via drush (drush cim sync), the config files don't seem to import properly, as the files are listed after a supposed successful import.
(and doing a cex sync shows configs to export, despite nothing being changed in the backend)

The only thing I have done recently is import a copy of a database from one of our live test servers, to get the content.

Is there a UUID I need to change or something?


texts: Solr multi-select facets occurs bad request error

texts:
I faced with a weird problem using apache solr faceting search. While selecting two facet constraints, solr respond with 400 error:

  "400" Status: null: null HTTP ERROR 400

  Problem accessing /solr/project/select. Reason:

  null

Basically I have one index configured and number of fields indexed inside. I'm using facet for "content type" field. There is no problem at all when only one facet constraint is selected.

  http://localhost:8983/solr/project/select?fl=item_id,score&fq={!tag=facet:type}ss_type:"system"&start=0&rows=10&sort=ds_created
  desc&facet=true&facet.sort=count&facet.limit=10&facet.mincount=1&facet.missing=false&facet.field={!ex=facet:type}ss_type&f.ss_type.facet.limit=50&wt=json&json.nl=map&q.alt=(ss_search_api_language:"sv")
  (index_id:"project_nodes_index") (hash:gf1tmd)

Problem starts where two constraints are selected:

  http://localhost:8983/solr/project/select?fl=item_id,score&start=0&rows=10&sort=ds_created
  desc&facet=true&facet.sort=count&facet.limit=10&facet.mincount=1&facet.missing=false&facet.field={!ex=facet:type}ss_type&f.ss_type.facet.limit=50&wt=json&json.nl=map&q.alt=(ss_search_api_language:"sv")
  ((({!tag=facet:type}ss_type:"system") OR
  ({!tag=facet:type}ss_type:"product")))
  (index_id:"project_nodes_index") (hash:gf1tmd)

Standart modules are used:
* search_api_solr
* search_api
* facetapi

Solr version 3.6.2


texts: Double click quickly on the entity save form two entity get created

texts: I am using Entity Construction Kit 7.x-2.0-rc2. I have created one entity type with some manage field as title,message. if i double click quickly on creating entity then it will save entity form two or more entities get created.


texts: Is it correct to make queries to DB in preprocess functions?

texts:
I've just started using Drupal after long experience of using other framework.
When I do something new, I'm scaring to crash performance because of my incomprehension.
So, my problem:
I want to add dynamically some data from database to some existing page region.
For example, I want to add list of child terms to taxonomy term page. And I don't need to change any other things on this page, so I don't want to turn on View.
Is it normal to query data in preprocess functions?
My solution for D7 was like this:

function mymodule_taxonomy_term_view_alter(&$build) {
  if ($build['#view_mode'] == 'full') {
    $children = taxonomy_get_tree($build['#term']->vid, $build['#term']->tid, 1);
    foreach($children as $term) {
      $build['children'][] = (array)$term;
    }
  }
}

function mymodule_preprocess_taxonomy_term(&$variables) {
  if($variables['vocabulary_machine_name'] == 'catalog') {

    if(count($variables['elements']['children'])) {
      $items = array();
      foreach($variables['elements']['children'] as $term) {
        $items[] = array(
          'data' => l($term['name'], 'taxonomy/term/' . $term['tid'])
        );
      }

      $variables['content']['children']['#markup'] = theme('item_list', array('items' => $items, 'title' => 'Text terms list', 'type' => 'ul', 'attributes' => array()));
    }
  }
}

Any comment are welcome.


texts: Where is Pathauto's "Strings to Remove" stored in MySQL?

texts:
I've tried looking in the "variable" table with SELECT name FROM variable but I think it's not there.

Where does the module save that setting?


texts: removing menu block title causing problems

texts:
I know how to remove the menu title from the block by going into the block setting and putting

<none>

in the title space.

But when i do this a smaller version of my menu appears in place of where the title was.

any clues on how to fix?


texts: Copy path to variable in array using Kint

texts:
In D7 using dmp() with Krumo in produced output like this:

Double clicking on a variable value, in this case "foobar" shows the path through the array to that value (the highlighted text in the image above).

Now with D8 it's using Kint not Krumo and produces output like this:

Is there anyway to copy the path to "foobar" using kint?

This is the text that I want: ['example']['#attributes']['class'][0]


texts: Get node id for page which is set for 403 and 404

texts:
I want to get the node number (nid) for the node which is set for 403 and 404 pages in drupal configuration system.
Can you please help me for this ?


texts: How to get the drupal version using phpMyAdmin query?

texts:
How to get the drupal version using query ? Or
how do we detect using query the drupal version is 7,6,5 or 4?


texts: I am creating a commerce store for custom clothing. I am trying to implement a product line item where users are posed with a dropdown of their uploaded artwork via a select list. I have created a content type called artwork that users will create. Now I just need to create a field that is a dropdown list of user-created nodes of artwork type. Does anyone know how to implement this?


texts: How can i add a page.tpl.php for a page type and a language?

texts:
I want to match a page--type-receipe.tpl.php for a page type but it doesn't work. I think the reason is the multi-language.

The page.tpl.php work without any problems.


texts: Using a drush alias with Elysia Cron - alias permission missing

texts:
Problem

I'm trying to run Elysia Cron with Drush. When I use the command drush elysia-cron in the correct folder it runs.

However when I use an alias it doesn't work: drush @main elysia-cron.

The alias works correctly. And after a bit of digging I found the following lines in debug:

"error":"DRUPAL_USER_LOGIN_FAILED"},
{"type":"error","message":"The drush command 'elysia-cron' could not be executed.",
"timestamp":1385993042.4437,"memory":60455120,"error":"DRUSH_COMMAND_NOT_EXECUTABLE"}]

Apparently when I use an alias it loses login permission.

The only user related function for Drush I could find is remote user, but I think that's only for running drush remotely through SSH. How can I give my alias login permission?


texts: Allow users to sort stories by date or content type

texts:
What is the easiest way to allow users to sort a story view by content type or date? Is there a module that would allow you to do so? The idea would be to have a drop down list containing the different content types and a calendar widget (or perhaps also drop down lists) which would allow users to determine a date range.

If this can only be achieved programmatically, no need to provide much detail -- I suspect it would be a rather long explanation and don't want to take that much of anyone's time.


texts:
How do I unpublish translations when the english content is unpublished? I tried to unpublish the language content programmatically when I am unpublishing the english content in the hook_node_update() but it returns below error.

$languages = getLanguageList();
$currLanguage = \Drupal::languageManager()->getCurrentLanguage()->getId();

if (!$node->status->value) {
    foreach ($languages as $languageId => $language) {
        if ($languageId != 'en' && $currLanguage == 'en') {
            if ($node->hasTranslation($languageId)) {
                $transNode = $node->getTranslation($languageId);
                $transNode->setPublished(false);
                $transNode->save();
            }
        }
    }
}

Error :

Uncaught PHP Exception Drupal\\Core\\Entity\\EntityStorageException: "Update existing 'node' entity revision while changing the revision ID is not supported."

So I guess if I can do this after saving the node it would work. Is there a hook for node after save. Or is there a way to unpublish language contents of a node while unpublishing the source language(English)?


texts: How to produce markup from a custom views field (FieldPluginBase based) render method in D8?

texts:
I've created a custom views field following the excelent Creating a custom Views field in Drupal 8 guide. The render method returns the desired output, except that it's being sanitized somewhere down the line and thus the html markup comes out as plain text on the page.

I'd rather put the html markup into the theme, but there doesn't seem to be such thing as

views-view-field-<fieldname>.html.twig

in Drupal8 ?


texts: How to use Drupal Commerce to extract all the people who purchased a specific product?

texts:
I want to create a report (a list) of all the people who purchased a specific product.

I want to use this list for a report to verify purchase when people pickup registration packs etc., so that I can confirm those people when they arrive.

How do I get this in a report format that I can extract from Drupal Commerce?


texts: How to allow users to unsubscribe from organic groups?

texts: In D6, more often than not users change their mind and want to unsubscribe from groups that the have subscribed. How can they do so?


texts: I s there a way I can show node teasers but don't allow access to full content?

texts: I need anonymous users to to be able to se the node teaser but don't allow access to the full content is there a way to do this?


texts: views in D7 :: remove doubles in exposed filter list

texts:
I have two content types, one (A) refering to the other (B). I also have two languages and I want to create a view where I show a list of all content type nodes of type A with an exposed filter, filtering the refering content type nodes of type B. this will show me all nodes of A that refer to B.
so my filters are

content type (A)
language (en)
refering node (exposed)

this works great but inside my exposed filter list of all nodes of type B every node is shown two times, representing every language translation.
I now want to only show the english nodes of type B in the exposed filter list.  how could I do that?
thnx!

ps: I tried to use the filter groups, but this did not work.


texts: How do I show a submenu when hovering over a menu item?

texts:
I have a Drupal 7 site. I need to create menu and sub-menu. I am using the Mega Menu module for this.

This is my menu structure.

Sub-menu not showing up when hovering over a menu item.


texts: How to add Variables in Drupal (and how to visualize them)?

texts:
I'm new to Drupal Answers, but I've been programming for a few years now.

I'm looking to create something simple (at least I think) within the Drupal CMS to use throughout the site. I want to create a variable, let's call it $phonenumber and store the value of this variable, like (789) 456-7894 (not a real number). That way I may use the value of this variable on my site without hardcoding the number.

I have installed the Variable module, which has little to no documentation, and poor usability all around.

I build in PHP, I know this is basic, Drupal is built on PHP. But for some reason I cannot get a printr or echo of the variable on any page to work.


texts: Drupal not detecting the correct version number of a module?

texts:
I am trying to transfer a site over, and run update.php.

Drupal is telling me that my system and menus modules are out of date. This is not the case - they're both up-to-date, in fact I downloaded the most recent ones and uploaded them to my public_html/sitename/modules folder.

Where is the version number stored, so that I can force Drupal to recognize that they are the correct module versions that Drupal is looking for?

Specifically for the menu and system modules.

This is in D7.


texts:
Is there any combination of Media module in version 2.x for Drupal 7 which works with Plupload Integration of any version?

I installed the newest dev versions of File entity, Media and Plupload but they don't work togheter.

Is there any other Bulk upload for Media which already works with version 2.x?

Are there any patches I can apply to get Media togheter with Plupload working?


texts: How to test any features that require authentication?

texts:
I am just getting started with BeHat and I'm able to successfully run tests that do not require authentication. But, anything that requires authentication is failing.

STATEMENT  (or any logged in statement)

Fails with ERROR MESSAGE .

But, if I add 'not-logged-in' as a possible class for logged in, then the test passes. This tells me that I am not successfully logging in with my tests. The test is actually finding a class 'not-logged-in' when it is testing to see if it's logged in.

I am getting email notification that a user has been created when the test runs. So, I know that a user is being created, but not successfully logging in.

Feature: Authentication
  In order to make sure Behaviour testing is working
  As a behat test user
  I want to make sure I can log in

  Scenario: Anonymous access
    Given I am on the homepage
    Then I should see "Login"

@api
  Scenario: Test Being Logged In
    Given I am logged in as a user with the "administrator" role
    Then I should see the link "Test Link"

My behat.yml file looks like this:

default:
  suites:
    default:
      contexts:
        - FeatureContext
        - Drupal\DrupalExtension\Context\DrupalContext
        - Drupal\DrupalExtension\Context\MinkContext
  extensions:
    Behat\MinkExtension:
      goutte: ~
      selenium2: ~
      base_url: http://mysite.localhost
    Drupal\DrupalExtension:
      blackbox: ~
      api_driver: 'drupal'
      drush:
        alias: 'local'
      drupal:
        drupal_root: '/Users/myfolder/sites/mysite'
      region_map:
        footer: "#footer"


texts: Render View or Block not Working in Drupal 7

texts:
So i have made a view and a block for a carousel.
I want to call this view or block in my template. (panels-pane.tpl.php).

I have tried to call the view with this function :

<?php $view = views_embed_view('carousel', 'carousel-block_1'); print $view; ?>

Unfortunately this is not working. Variable $view is NULL

I also tried to call a block in this template file with this function :

$block = module_invoke('views', 'block_view', 'carousel-block_1');
var_dump($block); // Empty ;s

Also not working..

The Delta ID is right. See Screenshot below for more information.

Do i something wrong?

Full page code with other view render (also not working):

<?php
// @codingStandardsIgnoreFile

/**
 * @file panels-pane.tpl.php
 */

?>

<?php if ($pane_prefix): ?>
  <?php print $pane_prefix; ?>
<?php endif; ?>
<div
  class="<?php print $classes; ?>" <?php print $id; ?> <?php print $attributes; ?>>
  <?php if ($admin_links): ?>
    <?php print $admin_links; ?>
  <?php endif; ?>

    <?php $view = views_embed_view('downloads', 'downloads-product_downloads'); print $view;     var_dump($view); ?>
    <?php print render($title_prefix); ?>
    <?php if ($title): ?>
    <<?php print $title_heading; ?><?php print $title_attributes; ?>>
    <?php print $title; ?>
  </<?php print $title_heading; ?>>
<?php endif; ?>
  <?php print render($title_suffix); ?>

  <?php if ($feeds): ?>

      <?php print $feeds; ?>

  <?php endif; ?>

  <?php print render($content); ?>

<?php if ($links): ?>

    <?php print $links; ?>

<?php endif; ?>

<?php if ($more): ?>

    <?php print $more; ?>

<?php endif; ?>

<?php if ($pane_suffix): ?>
  <?php print $pane_suffix; ?>
<?php endif; ?>


texts:
We have successfully build a multilingual Drupal website, the only thing that isn't being translated yet are the error messages.

We have the default Drupal 6 contact form on the website. All the field labels are translated correctly including the "Send" button.

However, when someone just tries to submit the form without completing the fields, the error message always show in English.


texts:
The problem I face is the following:
I have set up simplenews for creating newsletters. I am able to select articles, pages, events etc. which are already displayed on the website itself.
However, after I selected the ones I want to show up in the newsletter and create a table of contents, there is no link to the article. It just shows the plain text without linking. Also the view mode dropdown menue is empty.

can anybody help me with this?
cheers,
nebelwueste


texts:
I am on Drupal 7.

I have a Views block with a pager sitting on the bottom part of it. I am using AJAX pager, meaning the page isn't reloaded. When the pager is clicked, the block reloads all the elements inside of it to display elements on the second page. But because my block is kind of long, when the pager is triggered, I would like to take my user again to the top of the block. I can do that with an anchor that will slowly scroll the page to the anchor that sits on top of that block. There is no issue with this. My doubt is: how can I add a javascript listener that will capture a Views AJAX pager click so that my code can be executed? What is the right Drupal way of doing this? Thank you so much.


texts: Get term weight in node object for ordering with EntityFieldQuery

texts:
Is it posiible to expose taxonomy term weight in node object ?

I need to sort nodes using EntityFieldQuery by term reference field, but weight is not exposed to node object so i can say for example

->fieldOrderBy('field_custom_terms', 'weight', 'ASC');

and sort nodes by weight of terms.


texts:
I am using the Drupal 7 Bootstrap theme and Scald. I have figured out how to use contexts but would like it so that when an image is shown it has the img-responsive class.

Can this be done by manipulating the render array?

Can anyone point the best way to achieve this?


texts: Help with #text_format and field widgets

texts:
I'm struggling with #type 'text_format' for a widget form field as this field gets expanded two separate elements, one holding the orignal element and the other the format selector. The orignal element is moved into a child element.

All of this is fine, but as the orignal field is now moved into a child when the widget form is saved is tries to save the child element (array). As the widgets fields have to be at the root of the form with names that match 1:1 with db columns.

From form.inc:

  If the property #text_format is set, the form element will be expanded into
  two separate form elements, one holding the content of the element, and the
  other holding the text format selector. The original element is shifted into
  a child element, but is otherwise unaltered, so that the format selector is
  at the same level as the text field which it affects.

I've looked at the text.module but I can't work out how it is getting around the issue of the field being expanded?


texts: Custom variable in custom block template

texts:
I'm trying to create a block that will pass a variable to its template. For now just some text but it will be an array later.

The default block variables such as label are working but I'm unable to get the value to show up in template.

Any ideas ?

FrontAppsBlock.php

namespace Drupal\custom_blocks\Plugin\Block;

use Drupal\Core\Block\BlockBase;
use Drupal\Core\Block\BlockPluginInterface;
/**
 * @Block(
 *   id = "front_apps_block",
 *   admin_label = @Translation("Front Apps Block"),
 * )
 */
class FrontAppsBlock extends BlockBase implements BlockPluginInterface {

  public function build() {
    return array(
      '#theme' => 'front_apps_block',
      '#app' => 'test value',
    );
  }

}

custom_blocks.module

function custom_blocks_theme($existing, $type, $theme, $path) {
  return [
    'front_apps_block' => [
      'variables' => [
        'app' => null
      ]
    ]
  ];
}

block--front-apps-block.html.twig

test: {{ app }}

label: {{ label }}


texts: Which files should I delete after a Drupal installation?

texts: After installing Drupal, there are files in the root directory that I should delete. I know that install.php is one of those. Which other files should I delete?


texts: Compress images before generating PDF file

texts:
I am working with Views PDF Module, and I used it to export any node of content type "Appointment" as PDF file and then send it by email...

In my case the content type "Appointment" should have a field of type "Image", so that mean I will have many images included on the PDF file.

Let's imagine that the client upload 10 images with 1MB for each one , so that will make my website so slow in generating the PDF file and maybe will not continue all the process .

I need a tool which can compress images before saving the node and that will make it easier for generating the PDF file.

Is there any solutions guys!


texts: How to send a notification to a user at specified time (between 9am to 10 am) daily?

texts:
I have created a form which contains a CCK field "send sms" (checkbox) with two options:

Send sms between 9am to 10am  (= option 1)
Or anytime (= option 2)

If the user selects option 1, then notification should send between time 9am to 10am to user.

If the user selects  option 2, then notification should send at any time.

How to achieve this functionality?


texts:
I'd like to add an item to a multivalued image field rendered by the Field Slideshow module.
I need to display an image coming from field image B of entity B in the slideshow of field image A of entity A.
The Field Slideshow module implements hook_field_formatter_view.
I'd like to be able to add an item at the end of the $items variable of this function.
How can I do that ?


texts: How can I create bidirectional node references?

texts:
I want to have a node reference for a content type. I have two content types A and B. I want to reference content B from a field in content type A. In the same way I want to refer content type A from content type B. What I want is If I referenced content type B from content type A, Ta field should be added automatically to content type B with reference to content A.

Linking from A to B should make it linking from B to A too. Both should have updated fields for this.

How can I do this? Which module can I use for this?


texts: Images placed in blocks do not show up on certain pages

texts:
I hope this is not a silly question. I have created some links to social media using images inside custom blocks. The images show up on every single page on my local testing server, but after uploading to my production server, I notice that on pages where I use URL aliases that are not directly attached to the site url, the images don't show up. For example if I the page address is www.thebeat99.com/sandbox/competitions, the images show up just fine. If the page address is www.thebeat99.com/sandbox/profile/dami, the images don't show up. I have tried adding a base url in the settings.php file but it does not work either.

This is an example of the html I use to embed the images:


texts: og membership role is not displayed in views

texts:
I'm using organic group module and I have 3 og membership types:

'member'
'non-member'
'visitor'.

I created an view which shows me all user group listing under one group which includes users role also but it is not displayed.

In view I added an Relationships as 'OG membership: OG membership from User ' and added filed for the same.


texts: Multiupload widget - create more items inside single node

texts: I am looking for a solution - I want to upload multiple images (media module) into one node, so each image would be separate item. Is there any module out there? I found multiupload module that creates multiple nodes but that is not what I need. Thank you for any ideas.


texts: How can I avoid  the "The file x.jpg is in use and cannot be deleted." warning I get when I try to delete a media file?

texts:
On the page admin/content/media I'm trying to remove a file, and I get the following warning:

  The file x.jpg is in use and cannot be deleted.

We've been struggling with this issue for some time now, and it looked like the root of the problem was related to the list of revisions in the node the file was in. Deleting the revisions enabled us to delete the file.

Has anybody experienced this issue? Is there a way to fix it?

It's not a great idea for us to have to remove all previous revisions of a node in order to just delete some duplicated files from the media library.


texts:
We currently have a Drupal Commons website on version 7.50, commons 3.x. Our site is complex and we are no longer using many of the pre-packaged features in the commons distribution. We would like to simplify and modernize our website by "getting out of Commons."

I am wondering if it is possible to back out of Drupal commons without rebuilding from scratch and if it is possible, can it be done cleanly? E.g. Can we get back to Drupal Core and for every commons-specific feature we are using, could we theoretically replace the commons-specific configurations and modules with a Drupal 7 or native features and what are other the other implications?

This is a fairly arbitrary question but any information is appreciated. As I learn to re-frame the question, it will help to answer it. Guidance on asking is also appreciated, thanks!

Update and background info: I prefer Drush, use GIT and have a staging process as well as have set up sandbox copies of our site from back ups to be sure they work. I lack a good understanding about administrating Drupal itself and how Core differs from other profiles but am familiar with migrating Drupal sites and managing the database and codebase.


texts: Will memcache work in this configuration?

texts:
I've got a Drupal site running with

1 x Load balancer in front
2 x web servers running Apache, PHP and Drupal, traffic coming from load balancer, and
1 x Generic server hosting MySQL (MariaDB) Drupal database and sites/default/files accessed by the above 2 servers over the network.

If I wish to use memcached, would it work if I install memcached on the 2 web servers and configure Drupal to connect localhost using the memcache module?

Edit: are there any special consideration in order to make this work? I think I have read somewhere about session stored.


texts: How to get drush to list ONLY parent folders on module list command?

texts:
I use this command to get a list of contrib enabled modules:

drush pm-list --type=module --status=enabled --no-core --format=list

Problem is, it also lists submodules, for example:

admin_menu
admin_menu_toolbar

So if I use this to reinstall the modules on another site:

Drush dl admin_menu admin_menu_toolbar

It causes errors. So I need to drush only:

Drush dl admin_menu

So how can I get the list of ONLY parent modules?

My goal is to get drush to display list of modules on the source site, but only folder names, not subfolders


texts: How to add the node settings "Exclude node title" to a field group?

texts: Since the module does not provide an entry in the manage form settings, how to move "Exclude node title" to a field group in Drupal 8?


texts:
I need to output a JSON variable in my theme, data is saved in a node field. I can easily use hook_preprocess_node to decode the data and save it in axillary variable and then render it using a custom template file, but it would be much easier if I can decode JSON in twig file so there wont be need for implementing hook_preprocess_node or introducing new template file (as it can be achieved overriding field--FIELD-NAME.html.twig)
so I wrote a module to extend twig extension and add a json_decode filter to twig. this is my services.yml file:
services:
  twig_json_decode.twig_extension:
    class: Drupal\twig_json_decode\JsonToArray
    tags:
      - { name: twig.extension }

and this is the JsonToArray.php :
namespace Drupal\twig_json_decode;

use Twig\Extension\AbstractExtension;
use Twig\TwigFilter;

class JsonToArray extends AbstractExtension {

  public function getFilters(): array {
    return [
      new TwigFilter('decode_json', [$this, 'jsonDecode']),
    ];
  }

  // The actual implementation of the filter.
  public function jsonDecode($context) {
    $context = json_decode($context, true);
    if(json_last_error() === JSON_ERROR_NONE)
      return $context;
    return [];
  }
}

Then in my twig file I have:
{% for item in items | decode_json %}

    {{ item.label }} :
    {{ item.answer }}

{% endfor %}

which cause this error:

Twig\Error\SyntaxError: Unknown "decode_json" filter. in Twig\ExpressionParser->getFilterNodeClass()

I have the module enabled and cleared the cache but it seems that the custom filter is not affecting twig.
How can I make sure that my module is called and working properly?
--UPDATE--
I Used drush devel:services to get a list of available services but the service name twig_extendion was not listed there so it seems that my service is not introduced to Drupal, but I cant figure it out why this might happen !!!
any problem in my services.yml file?


texts: How to add wrapper to article teaser content

texts: I need to add a wrapper around the title, body, id, and created fields of the teaser below but am not familiar with how to implement this in a twig template. I need to have the image in a seperate container from the rest of the content:


texts:
My Drupal 6 taxonomy terms are linked to two types of content, one is called Results (text) the other is a Photo.  Is it possible through Panels to develop a node where a user can select a term via a drop down menu then it will display only the Results and the pictures related to that term?  My goal is to have all of the results together in their own region and the same with the photo.

If it can be done, is there a recommended recipe I should follow?

If it can't be done any suggestion on how to do it?


texts: How to configure an exposed filter in a view using a date picker?

texts:
How can I configure an exposed filter so that users can filter my site content by creation date, preferably using a date picker?

I tried using Content: Authored on as filter, but it gets me a text field to enter the date to enter a date/time in the yyyy-mm-dd hh:mm:ss format, which makes entering the date more difficult for users and more error prone.

What is the difference between Drupal 8 and Drupal 7 with Views 7.x-3?


texts: How to handle pdo exception error gracefully for user experience

texts:
Integer fileds can accidentally be entered with 'Out of range' error. This time a user has no other option but to click back button.
Any suggestions on templating these kinds of errors or for any other errors of the same nature?


texts: How to create a rule to redirect users to specific content according to their email domain?

texts:
I'm trying to setup the Rules module in D8, but I'm unable to do so. I want to redirect users, according to their email domain they used to register themselves on my website, to specific pages:

Example:

User has signed up with email @gmail.com -> redirected to node/1.
User has signed up with email @yahoo.com -> redirected to node/2.
User has signed up with email @aol.com -> redirected to node/1.
User has signed up with email @xxxxx.com -> redirected to node/1.
Etc.

Can anyone show me how to do it?


texts: How can I programmatically change the view mode?

texts:
In Drupal 7 I did something like:

  function mymodule_views_pre_render(&$view) {
    //dpm($view);
    if ($view->name == 'services') {
      $view->style_plugin->row_plugin->options['view_mode'] = variable_get('services_teaser');
    }
    else if ($view->name == 'portfolio') {
      $view->style_plugin->row_plugin->options['view_mode'] = variable_get('portfolio_teaser');
    }
  }

I don't know how to set the view mode on the fly, in Drupal 8. The idea is to be able to select the view mode for the view from a configuration form, instead of doing it from the view form.

How do I achieve this?


texts: How to add a specific menu item in Panels?

texts:
I am using Drupal 7. I made use of panels to partition the look of a page. I would like to know whether it is possible to add "A specific menu item" in the panels? I have used node templates to generate this page. I have 6 menu items(main menu), i want only one of them to be present in the panels.

Thanks in advance.


texts: at admin/config/workflow/rules/settings one can configure settings for logging related to rules and it states that: "Evaluations errors are logged to the system log".  What and where exactly is the 'system log'?


texts: How to create a view filter plugin to filter a column created by a view field plugin

texts:
I have created a view field plugin to display an "internal status" for each node in a view.
Those status are not stored in a table (and should not) because each status may vary depending the current date (and some other fluctuating data).
The possible status outputted by this virtual field (not sure it is the correct terminology) are 1,2 or 3 (integer)
Here is the simplified code
1-Declare the virtual field in hook_views_data_alter()
function mymodule_views_data_alter(array &$data) {
  $data['node']['internal_status'] = [
    'title' => t('Internal Status'),
    'field' => [
      'title' => t('Internal Status'),
      'help' => t("Display internal status"),
      'id' => 'internal_status',
    ],
  ];
}

2- Create the view plugin
/**
 * Field handler to display internal status.
 *
 * @ViewsField("internal_status")
 */
class NodeInternalStatus extends FieldPluginBase {

  public function query() {}

  public function render(ResultRow $values) {
    $node = $values->_entity;
    $value= return_1_2_or_3_depending_on_dyn_data_like_the_current_date($node);
    switch ($value){
      case 1:
        return t('This is 1');
      case 2:
        return t('This is 2');
      case 3:
        return t('This is 3');
    }
    //will never go here if everything is ok
    return t('n/a');
  }
}

My Question: I would like to create a filter plugin to filter nodes according their internal status [by using return_1_2_or_3_depending_on_dyn_data_like_the_current_date($node)]
I have tried to extend the inOperator class but as the real column of the "internal status" field doesn't exists in the DB, I keep getting the following error:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'node_field_data.internal_status' in 'where clause':


texts:
I have a webform block on a page and i am looking for a way to get the webpage title in one of my fields. I have been looking for a while now and have not found a solution to my issue. One of the things that i found was using [current-page:title] but i cant get it to work i keep getting [current-page:title] to return in the field.

I found it off of this post: https://drupal.org/node/1782042, but i am afriad that i am using it the wrong way from what they explain and i may not understand what they are doing.

I have tried:

[current-page:title] and got [current-page:title] to return

%get[current-page:title] and got %get[current-page:title] to return

Does anyone know where i am going wrong or possibly have a solution to returning the title of the page in the webform field? I am pretty new to drupal development and any help would be much appreciated. Thank you!

---EDIT---

The reason why %title is not an option is because it will only grab the title of the block. I need the current title of the page that the block is on. Any ideas?


texts: how many content type fields can I have on a drupal site?

texts:
I have a Drupal site for tracking equipment. I have a bunch of content types that are basically questionnaire forms that are related to the equipment. I need to associate those with specific equipment nodes.

ex. equipment node "1500" has 6 forms that each have numerous fields that need to show up under it when you view the full node. I've done this with entity views attach and it works fine. But one of these forms has about 85 fields in it. Most of these fields are checkboxes/radio buttons. Some of the other forms have 40-50 fields.

I recently noticed my site's performance slowing to a crawl after adding these fields to one of the content types and I'm worried that there are too many fields. I can't find any info on how many fields I can use though. Does Drupal limit the number of fields? Or is there some other limitation that could cause a problem?

RJ

BTW: I was going to use webform, but I can't access the fields in views with that (don't think so, anyway)


texts: How to add contents through block after enabling the blog module in drupal 7

texts:
Currently creating a single page responsive business website. Planning to add blog link to our site. For that we enabled the core blog module and added data.
But we want to add the contents through block!!! can anyone specify me with a solution?


texts:
I'm using D8 and the page_manager and panels modules. I've used the D7 equivalents before and it's been easy to add a specific field for a node to the content section of a panel.

However in D8 when I try and add the fields there are no options that come up in the content section for specific fields.  The only node related option I see is for whole entities and their display modes.

Is there another module that I need to enable to get the individual fields from a node like in D7?


texts:
I created a view block and placed it in the content region. There is no role restriction. That means all users can view the block. However, only authenticated users can view the block. I am not sure how to fix it.

How can I display the block to public?


texts: How can I use month name as contextual filter?

texts:
I have a contextual filter to filter by month:

Date in the form of MM (01 - 12).

However, I want to filter by month name (january, february, march, etc.) to get nicer URL and breadcrumb.

Is there an easy way to do it?


texts:
How to customized the node edit page?
i was created one cart site for online education.
here i need one button to while edit the  node one of the content type?
how to create an button in node edit page?
how to add function for specific function for that button.


texts:
I have a webform. If I go into the backend "content management => content" area and click "edit" for the form and then "preview", the form preview displays fine.

However, if I view that same webform on the frontend, I see either:

"Published by admin on Tue, 07/19/2011 - 15:15" if I am logged in as a new user
"Published by admin..." and in my $messages "You have already submitted this form. View your previous submissions." if I am logged in as a user who has submitted the form before.

This form was displaying fine at some point. Obviously someone working on the project (quite likely me) has broken it since then.

The form is published. The submission limit is set to "unlimited". The "status of this form" is set to "open". The "submission access" settings allow any "authenticated user" to submit the form.

What are some reasons for why my form might not be displaying? Do I need to add something in my page.tpl.php to have it display? What's the quickest way for me to debug this?


texts: Feeds Importer won't import autocomplete field

texts:
I'm trying to use the Feeds Importer plugin. I have a field that's an auto complete and it maps to a NID. I have the NID in the csv file I'm trying to import but it doesn't ever populate that field. It does populate every other field correctly, though.

Any thoughts why this might not be working?


texts: View inside a node with content from a relationship

texts:
I have two content types: Artist and Artwork.
An Artwork has a field called field_artist which relates to the relevant Artist node.
I want to add a view to the Artist node page, so that all artworks of that artist are displayed.
I tried using EVA, but I can't figure out what relationship and contextual filters to choose. I looked for tutorials but I find this very confusing.
Is there a way to do this with EVA OR in some other easy way? The only crucial thing is that the entity reference field from Artwork to Artist must be used to filter the artworks in the view.
Thanks!


texts: How do I programmatically "place" an order?

texts:
When making a payment through the Commerce admin interface; the Orders do not get completed. I can see a Place Order button when viewing a cart Order; which seems to do the trick. I need to do this in code.

I know that i need to react to the the commerce_order.order.paid event but I am not sure what to do there.

I found this post: How do I programmatically update the order status? which suggests i need to "apply a transition". But the suggestion there doesn't work.

I opened a new question for this as I am specifically asking about "placing an order"; whereas that question was asking about simply changing Order status.


texts: Drupal 7 drupal_add_tabledrag dragging but not dropping

texts:
I am trying to use the drupal_add_tabledrag in a form table, the dragging is added fine, but dropping is not working

$entity_ids = range(10,20); // Loading dummy data

$entities = entity_load('node', $entity_ids);
$rows = array();

foreach ($entities as $id => $entity) {
    $rows[$id] = array(
        'data' => array($entity->title),
    'class' => array('draggable', 'entity-weight'),
    );
}

$form['settings']['entities'] = array(
    '#tree' => TRUE,
    '#theme' => 'table',
    '#header' => array(t('Title')),
    '#rows' => $rows,
    '#attributes' => array('id' => 'entity_table')
);

$form['settings']['title'] = array(
    '#type' => 'textfield',
    '#title' => t('Find entity'),
    '#autocomplete_path' => 'list_bean/autocomplete',
);

drupal_add_tabledrag('entity_table', 'order', 'self', 'entity-weight');

return $form;

I can rearrange items using drag, but I cannot drop the item I drag, it sticks tot he cursor.


texts: Why does external js only appear in header? D7, in a block, via custom module

texts:
I'm trying to add a box.com file upload widget to certain pages in a block. The upload widget is an external js script. I'm adding it via a custom module, using hook_block_view,

switch ($delta) {
    case 'box_com_photo':
    $block['subject'] = t('Box File Uploads: Photography');
    $block['content'] = array(
        '#attached' => array(
        'js' => array(
            'scope' => 'content',
            'data' => 'https://app.box.com/embed/upload.js[custom widget code]',
            'type' => 'external',
          ),
        ),
      );
      break;

Regardless of the scope, it always shows up in the page header.

Suggestions??


texts:
I want to override taxonomy term view views-view-field.html.twig to style the list of taxonomy term content.

I can't seem to find what the correct override is. My debug suggestions are not suggesting anything.

I have tried:

views-view-fields--taxonomy-term--%.html.twig
views-view-fields--taxonomy-term.html.twig

What is the correct template name to target the views-view-fields of the taxonomy term view?


texts:
I wonder if any still remember how to override a particular node in Drupal 5 ? I have tried out several ways but didn't work. Couldn't find such info any more on google.

node-13.tpl.php

node--13.tpl.php


texts: D7 : Views exposed form with three taxonomy term fields as filters (checkboxes)

texts:
Any help would be very much appreciated please.

I have a content type named restaurant and I have three taxonomy term fields (cuisines, neighborhoods and occasions) in it. I've created a view to expose these 3 fields as checkboxes for users to search restaurants accordingly.

Cuisines and Neighborhoods are required fields in the node, but not occasions. The problem is that if there is a restaurant that has not been tagged with an occasion, that restaurant will not show in the search results because in my filter criteria, I've selected "is one of" > all the terms in occasions.

I need help to turn this occasion filter as an optional one, where a node that has not been tagged with an occasion will appear when the user select a cuisine or neighborhood where this node is listed in.

I believe that this can be done via hook_views_query_alter but I don't know how.


texts: Is Pathauto designed to modify URL requests?

texts:
I have configured Pathauto to redirect /node/23 to /resource/resourcename. Should it render menus as /resource/resourcename, or still /node/23? If a user requests /node/23, is Pathauto supposed to change the request to /resource/resourcename?

Currently, it does allow for /resource/resourcename to be used, but it does not actively change /node/23 if it is entered.


texts: Send the email when specific node is created

texts:
In one of my module, i have created a checkbox on user account page. If user has checked that checkbox at that time an email is sent to all the user when any specific node is created. Lets say when any article node is created then all the users who has checked the checkbox will be notified by the email when node is posted.

Now for the scenario given below:

Lets say if my site has 1000 users who has checked the checkbox/
Simultaneously 10 users are creating the node.
When only 10 users are creating the node simultaneously 1000 * 10 = 10000 emails will be sent at time.
I am not sure whether site will able to handle it or not.

So i want the suggestion that is there any way to queue email and send them after certain intervals like 1000 mails after an hour, 1000 after second hour 1000 after 3rd hour and so on. Or any other nice solution.


texts:
I am studying the pager_example in example module.

When creating an render array, it first assign #theme as 'table'. But it assign the #theme as 'pager' just before returning.
What is the purpose of attach the pager theme ?
pager_example.module:

// Create a render array ($build) which will be themed as a table with a
// pager.
$build['pager_table'] = array(
  '#theme' => 'table',
  '#header' => $header,
  '#rows' => $rows,
  '#empty' => t('There are no date formats found in the db'),
);

// attach the pager theme
$build['pager_pager'] = array('#theme' => 'pager');  <---- why need this ?
return $build[];

Then I remove the coding "$build['pager_pager'] = array('#theme' => 'pager');". The result is the same.
When compare to tablesort_example.module, it don't have attach the pager theme before the return.
tablesort_example.module:

// build the table for the nice output.
$build['tablesort_table'] = array(
  '#theme' => 'table',
  '#header' => $header,
  '#rows' => $rows,
);

return $build;


texts: No more error messages shown, once i uploaded a file of invalid size?

texts:
The scenario is as follow:
when i uploaded a file with invalid extension a proper error shown, everything is fine. nothing bad with invalid extensions.
where as:
when i uploaded a file of larger size (greater than limit) an error shown.
and if i tried second time with invalid file(i.e both for size and extensions) no error shown and file is also not uploaded.
i want to display errors in all tries with invalid files.
and i am using HTML5 Drag & Drop File module for uploading multiple files by browsing or drag and drop

any help please


texts:
I have created a custom module to create a few placeholders in form fields.  Unfortunately, I am having a little trouble with getting two of them to work.  The code I have in the module is as follows:

function solid_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'search_block_form') {
    $form['search_block_form']['#attributes']['placeholder'] = t('enter search terms');
  }
  if ($form_id == 'user_login' || $form_id == 'user_login_block') {
    $form['name']['#attributes']['placeholder'] = t( 'Username or Email' );
    $form['pass']['#attributes']['placeholder'] = t( 'Password' );
  }
  if ($form_id == 'user_account_form') {
    $form['name']['#attributes']['placeholder'] = t( 'Username' );
    $form['mail']['#attributes']['placeholder'] = t( 'Email Address' );
    $form['pass[pass1]']['#attributes']['placeholder'] = t( 'Password' );
    $form['pass[pass2]']['#attributes']['placeholder'] = t( 'Confirm Password' );
  }
  if($form_id == "views_exposed_form"){
    $form['title']['#attributes'] = array('placeholder' => array(t('Search by Title')));
    $form['sku']['#attributes'] = array('placeholder' => array(t('Search by SKU')));
    $form['commerce_price_amount[min]']['#attributes'] = array('placeholder' => array(t('Min Price')));
    $form['commerce_price_amount[max]']['#attributes'] = array('placeholder' => array(t('Max Price')));
  }
}

(In order) The search block placeholder texts works perfectly.  The login placeholders also work perfectly.  The register (user_account_form) placeholders are not working at all, and I can not figure out why.  And the views_exposed_form works for the title and sku, but not for the min and max price range?

I need helping figuring out what I did wrong on the register form, and the min/max view filter price range fields.

EDIT:  I have gotten everything to work except the registration passwords.  When I uncomment the line for the password fields, they are no longer displayed on the page.

    function solid_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'search_block_form') {
    $form['search_block_form']['#attributes']['placeholder'] = t('enter search terms');
  }
  if ($form_id == 'user_login' || $form_id == 'user_login_block') {
    $form['name']['#attributes']['placeholder'] = t( 'Username or Email' );
    $form['pass']['#attributes']['placeholder'] = t( 'Password' );
  }
  if($form_id == "views_exposed_form"){
    $form['title']['#attributes'] = array('placeholder' => array(t('Search by Title')));
    $form['sku']['#attributes'] = array('placeholder' => array(t('Search by SKU')));
    $form['commerce_price_amount']['#process'][] = 'placeholders_process_commerce_price_amount';
  }
  if ($form_id == 'user_register_form') {
    $form['account']['name']['#attributes']['placeholder'] = t( 'Username' );
    $form['account']['mail']['#attributes']['placeholder'] = t( 'Email Address' );
    //$form['account']['pass']['#process'][] = 'placeholders_process_password_confirm';
  }
}
function placeholders_process_password_confirm($element) {
  $element['pass1']['#attributes']['placeholder'] = t( 'Password' );
  $element['pass2']['#attributes']['placeholder'] = t( 'Confirm Password' );
  return $element;
}
function placeholders_process_commerce_price_amount($element) {
  $element['min']['#attributes']['placeholder'] = t( 'Min price' );
  $element['max']['#attributes']['placeholder'] = t( 'Max price' );
  return $element;
}