texts:
I am a total beginner with Drupal and am trying to create a very simple "Hello world" module. I've been following the guide "A Hello World custom page module", but I still get a "Page not found" message.

My directory structure looks like this:

    drupal
        modules
            custom
                mymodule
                    src
                     |- Controller
                     |     ExampleController.php
                     |- mymodule.info.yml
                     |- mymodule.routing.yml

The module shows up in the admin panel, and I have activated it.

Here's what my routing file looks like:

mymodule.content:
  path: '/example'
  defaults:
    _controller: '\Drupal\mymodule\Controller\ExampleController::content'
    _title: 'Hello World'
  requirements:
    _permission: 'access content'

Here's mymodule.info.yml:

name: Hello World Module
description: Creates a page showing "Hello World".
package: custom

type: module
core: 8.x

dependencies:
  - datetime
  - link
  - views

configure: hello_world.settings

hidden: false

# Note: do not add the 'version'  property yourself!
# It will be added automatically by the packager on drupal.org.
version: 1.0

And here's the controller:

/**
* @file
* Contains \Drupal\mymodule\Controller\ExampleController.
*/

namespace Drupal\mymodule\Controller;

use Drupal\Core\Controller\ControllerBase;

class ExampleController extends ControllerBase {

    /**
    * {@inheritdoc}
    */
    public function content() {
        $build = array(
        '#type' => 'markup',
        '#markup' => t('Hello World!'),
    );
    return $build;
    }

}

When I go to  Configuration/Development/Performance and click "Clear all caches" I get this error message:

ReflectionException: Class \Drupal\mymodule\Controller\ExampleController does not exist in ReflectionMethod->__construct() (line 128 of core/lib/Drupal/Core/Entity/EntityResolverManager.php).

I have tried experimenting with the directory structure, for example moving mymodule up directly to modules instead of custom, but to no avail. What am I doing wrong?


texts: Creating a Redirect from old url to root

texts:
I'm trying to create a 301 redirect from a link from my old site format(because links are coming in from this URL).

The URL I'd like to redirect is like this:

http://www.example.com/Default.aspx?id=index

I'd like to simply have the above url redirect to the homepage:

http://example.com

I've tried several options, but nothing seems to be working.
Any help?


texts: Upload new item (node gallery) link not showing with a user of different permission - Drupal 7

texts:
I created a new content type named "Home" which is connected to node gallery. I created a new role named "Home only" and gave permission. When I logged in as a user with role of Home only, I am not able to get the "Upload new item" link. Did I miss any permission. Please give me a solution.

I gave all "Home" Node level permission, File Entity permission, Filter permission,View the administration theme permission, Use the administration pages and help permission.

Please note: I am getting the "Upload new item" link when I logged as administrator. Also plupload is using for the bulk upload.

When I logged as "Home only" level user, I getting all the links as in the above image except "Upload new items"


texts: Hide certain views fields only on particular content type

texts:
I am working in Drupal 7. I have a view that filters on 'Is one of' content type 'blog post' or 'member news story'. I need to adjust the output of the view so that when the content returned in the view is a blog post the author and the author company are shown, but when the returned content is a member news story the author and author company are hidden. My view has a relationship 'Content: Author'.

First of all I tried using Global PHP. I am using the realname module and was able to return the realname of the author by adding the following code to the output field of a Global PHP field:

    <?php
    if ($row->type == 'member_news_story'){
         print ("Author: ");
         print($row->realname);
    }
    ?>

I would have thought that I could just as easily use the replacement pattern for my field for the authors company, but adding the following code beneath 'print($row->realname);' simply prints a number i'm guessing this is a NID.

     print($row->field_guest_blogger_company_or_o);

I tried following advice like that give in questions like returning nod ID in views php and global php in view using print_r($data); to return the available data and then trying to drill down into it to get the variable I need.
Unfortunately I was not able to return the company name. I expect this was more complex as the the company name is not in the returned node, but is a user field. After spending ages on this and getting no where I decided to try a different approach -

I thought that it might be better to work with the template.php file and create a hook for the company name views field. In template.php I added:

    function amrc_new_views_view_field__news_blog_front__block__field_guest_blogger_company_or_o(&$vars) {
       return "views theme view field working";
    }

I could see the text 'views theme view field working' in the correct place showing the hook was working. I was able to use dpm($vars); instead of the return statement above to return a devel/krumo display of the available variables. However I struggled to be able to print any of the variables to the screen, which I would like to be able to do before I try using them to only print the company name if the returned node is of the type 'blog post'.

To recap, my question is: When the content returned in the view is a blog post I need to show the author and the author company, but when the returned content is a member news story the author and author company are hidden. I would like to know whether using global php in views or a hook in template.php would be the best way of going about achieving this. I would also like suggestions on how to access the company name variable so I can work with it. I have been struggling with this for a long time, so your input would be really appreciated.

If required I can easily supply the output of the using print_r($data) in the view and the dpm($vars); in the hook, but left these out for brevity.


texts:
Is it possible to modify a field on a node via a url string? For example, my node (1) has a field (field_stage) which I'd like to update using the following url:

www.mysite.com/node/1?field_stage=complete

I can't seem to find a lead on this. Any help is greatly appreciated.


texts: change save button text of a node to submit

texts: I am using drupal 7.10 I have a content type in which i want to change the save button text to submit.I tried various posts in this forum to no avail.i need help on this.Thanks in advance.


texts:
I've added a "header" block-region to the theme I am using (I am using the Visia Theme) and I've done this like so:

In my visia.info file:

regions[header] = Header

and in my page.tpl.php file:

<?php if ($page['header']): ?>
    <div class="header">
        <?php print render($page['header']); ?>
    </div>
<?php endif; ?>

This appeared to work, at first...

When I go to the Blocks page, the block region header does show up.

Also, when I click Demonstrate Block Regions (visia), I see my block region, and its respected my CSS for it!

The issue is when I go to my actual webpage. The block isn't there at all! Even when I inspect the Page Elements in the developers console, I don't see anything for that block region, nor do I see any affects of the changes that I made to page.tpl.php!

And yes, I have "Cleared the Cache" many times...

Is there something I've missed?


texts: Is there a postcode for deliveries checker module for drupal 7?

texts:
I'm thinking about using Drupal for a take away (delivery) ecommerce site and was wondering if there is a module that could calculate the the distance between the postcode added by the user and the shop locations (a few) and if its within a certain radius go ahead and allow the user to place the order. Is there such module available for drupal? if not, is there a similar module(s) that could be adapted to it?

Thanks


texts:
I have a registration form, and in the beginning of my registration page I want to show a title, subtitle and an image. A wireframe is like this:

As you can see there are checkboxes (select field) of my register form. But I would like to know how I can add the upper part to my page (Title, subtitle, logo).

What would be the best way to do this?


texts: Using Drush without typing drush every time

texts:
This might be a dumb question and is probably more of a general question for using the command line, but how can I create a command setting where drush is set in the current terminal session. I already have the correct path set where I don't have to type the full path to drush every time, but I'd like to be able to open the terminal up with drush set in the session until I exit the terminal.

For instance instead of opening up terminal and having to type drush everytime:

$ drush dl ctools

$ drush en ctools

$ drush .... (everything else that you want to do)

I can open up the terminal where drush is already set, something like this where drush  becomes the user and I don't have to type it:

drush$ dl ctools, pathauto, ...
drush$ en ctools


texts: Creating a dynamic image via PHP within a block

texts:
I'm migrating a site from Drupal 5 to Drupal 8.
The original D5 site has a page created by a PHP routine,  with an included dynamic image, created by a separate PHP routine. The page outputs HTML in the form:

    <img src="http://mysite/php/graph.php?f=myFileNameHere>

I've written a block to replace the original page, but am now stuck. How can I create the image in Drupal 8? There seems to be no way of just running any piece of PHP code, to produce any output, without first creating a page or block, and thus having loads of Drupal overhead.


texts: How to add a different specific image for each page in a region?

texts:
I want to have a different specific image on every page in the same region for each. I don't want to have to create separate blocks for each one. Is there an easier way? I will be getting the images from the directory.

Thanks


texts: Looking for a hook called before any session is created

texts:
I am using Drupal 7 and am looking for a hook which is called before any session is created.

According to the the API page, hook_boot() is called after DRUPAL_BOOTSTRAP_SESSION.  The link is for Drupal 6, I assume nothing changed in Drupal 7.

Is there a hook I can call which is called before any session is created?


texts: How can I display empty text for an empty CCK field that is output in a node template

texts:
I am using a node-content_type.tpl file to control the content display of a certain content-type. I am rendering the fields like so:

print $node->field_name[0]['value'];

I want to display some empty text if the field is empty so it doesn't show up blank. Is there a way to set empty text for all of the field of a content type so I don't have to check every field individually? Can I do this in a preprocess function in my theme's template.php file?


texts: Drupal Commerce Kickstart cloud zoom image not working?

texts: I am using Drupal commerce kickstart. I want to show the thumbnail images. I am using custom html theme in my project. How to show the thumbnail image in product page? Please anyone guide to me.I am new to Drupal commerce kickstart.


texts:
I am using a code

<?php
print $view->display['view_machine_name']->handler->options['title'];
?>

I put machine name in view_machine_name and everything work but I have few displays with different machine names and in other cases I still print same title. Can I get a function which takes the view machine name?


texts: Why my query string generates page not found for my view?

texts:
In Drupal 7 I'm using a view export to download information for my orders.

If i go to the default url /admin/commerce/orders then the page downloads correctly.

However, I also have some filters so I can download only the orders I need, this passes a query string to the view which causes a 404 error (page not found).

In example:

  /admin/export/orders?status[0]=invoiced&event=All&school=&uid=&held=All&attach=admin_page

I can't find out why this is causing a 404 error.

I have another view with the same configuration and it works fine. It is a number of query or something?


texts:
I am build a webform to send emails.
I have some user local accounts.
I would like to login with personal user account and send an email, choosing from a list of possible senders.
It is possible in that webform to choose from which email I want to send?
For e.g. I have 2 emails

email for advertise
email for internal communication

I would like to go to webform, choose from which this 2 emails I want to sent, is this possible?


texts:
I am using a webform to build a basic person node and other related nodes (contact, address) at once.

I'd like to have node tabs ("Contact Infos", "Address") when showing the person node, which are showing the related nodes using url aruments like "/node/1234/contact" or "/node/1234/address".

Do I have to use the hook_menu in a custom module or is there another way to do this?


texts:
I have a base theme and a sub-theme. The sub-theme specifies a single styles.css in the *.info file. The base theme provides CDN css stylesheets, via this hook:

function MYTHEME_preprocess_html(&$css) {

  drupal_add_css('http://yui.yahooapis.com/pure/0.5.0/pure-min.css', array(
    'group' => CSS_THEME,
    'preprocess' => FALSE
  ));

  drupal_add_css('http://yui.yahooapis.com/pure/0.5.0/grids-responsive-old-ie-min.css', array(
    'group' => CSS_THEME,
    'browsers' => array('IE' => 'lte IE 8'),
    'preprocess' => FALSE
  ));

  drupal_add_css('http://yui.yahooapis.com/pure/0.5.0/grids-responsive-min.css', array(
    'group' => CSS_THEME,
    'browsers' => array('IE' => 'gt IE 8'),
    'preprocess' => FALSE
  ));

  drupal_add_css('http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css', array(
    'group' => CSS_THEME,
    'preprocess' => FALSE
  ));

}

The resulting HTML is this:

<style type="text/css" media="screen">@import url("http://mysite.local/sites/all/themes/mytheme/styles.css?nezret");</style>

<link type="text/css" rel="stylesheet" href="http://yui.yahooapis.com/pure/0.5.0/pure-min.css?nezret" media="all">

<link type="text/css" rel="stylesheet" href="http://yui.yahooapis.com/pure/0.5.0/grids-responsive-min.css?nezret" media="all">

I need the @import to come in dead last in rendered order -- otherwise it seems the base theme styles are overriding my theme specific styless...

I have tried to correct this in the sub--theme by doing:

  function MYTHEME_css_alter(&$css) {

    foreach($css as $key => $value) {
      if($key == 'sites/all/themes/MYTHEME/styles.css') {
        $css[$key]['weight'] = 1000;
      }
    }

    uasort($css, 'drupal_sort_weight');

  }

This fixes the array but not the rendering order...WTF am I missing or doing wrong???


texts: Allow user to use entity reference to nodes they own?

texts:
I have a Doodad content type that has a couple of Entity Reference fields, for example, parentDoodad. Those fields point to other Doodad nodes. When I'm logged in as an Admin, I'm able to use the auto-complete field to set any doodad in the parentDoodad field.

However, if I switch to a different user and create Doodad1 and Doodad 2 (so that I have multiple nodes owned by this user), when I try to use the entity reference field, it won't show me any of my other Doodads.

If I give my non-admin-user the "Bypass content access control" permission, then I'm able to see and choose those other Doodads in the parentDoodad field.

I want users to be able to choose any of their own Doodad nodes. Is it just a matter of configuring certain permissions? How do I let UserA be able to choose from UserA's nodes in that entity reference field?


texts: Is there a way to trigger migration imports from the admin UI?

texts:
I want to use module WordPress Migrate to import content from WordPress into my new Drupal 8 website. I can use the module's button "+Add import from WordPress" appearing on page admin/structure/migrate to create a new import group from a WordPress XML file. That is working alright.

After I create that Migration group, I can enter its details page. It will then display all migrations I may run from Wordpress.

What I can't do through admin interface is actually running the import. It is said that the absolute best option for this is running the import script on Drush and I can do that on my Docker local environment by running:

drush mi --all

I could also specify the name of the import group I want to use, but this is not the point here.

My question is: although it is not recommended because a PHP script could timeout etc., is it possible to run the import from within UI? I will import ~ 200 posts from Wordpress, which is not a daunting task for the website and I don't see any risk for script timeout.

Anyway, I can't find a command button or link to trigger the import process from UI. Why do I want to do that? Because my website will be hosted on a shared host where I don't have access to Drush commands.

In case such an option isn't available, what would you say are my options here? Create a custom module that would run this import only once? Is this a simple task to take over?


texts: Set a main-menu item as active with custom code

texts:
I want to set a menu item of the main menu as active (class="active").

I'm specifically looking for a hook or function, not a contrib module.

I have seen recommendations for Context, and I have looked in the module code, but it uses hooks which I cannot find on the API-Site.


texts: Get fields out of an entity returned by EntityFieldQuery

texts:
I have a video content type. I run the following query in hook_cron:

$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'node');
$query->entityCondition('bundle', 'video');
$query->propertyCondition('status', 1);
$results = $query->execute();

This returns number of entity object with property nid, vid and type. I want to use this object to find a value of a particular field of the video (say duration). I don't want to use node_load, because I would have done that in the first place instead of using the query. How can this be done?


texts:
I recently installed the "simplenews" and "simplenews_scheduler" modules. The first module generates a view where you can see the newsletters.
My idea was to create a relationship in that view to gather the data from the "simplenews_scheduler" table to know if a newsletter has an active schedule.

I tried the "views_data" and "views_data_alter" hooks but I can't add the "activated" field of the "simplenews_scheduler" table. The base table of the view is "node_field_data"

Is it possible to do what I'm trying to do? And if so, can someone tell me what I should do?
Thank you very much.


texts: Bringing CKeditor, embedded content (e.g. iframe) and responsive design together

texts:
I like to bring together the usage of CKeditor with embedded content (for expamle youtube / issuu) in a responsive website.

I have so far:

CKeditor with Media module integration and Media-Youtube to simply embed youtube-content via the media-library. Making the videos responsive works like a charm with fitvids.

Main question: i'm interested to either generalize these components or find another solution to make this work. Do i have to write something similar to fitvids and media-youtube for every embed-type i want to use or is there a solution out there that i overlooked?

Other suggestions highly appreciated. I'm kinda stumped at the moment... Thanks!

Edit:
For example i'd like to integrate issuu (http://issuu.com/) elements in the same manner like youtube-clips: the editor just adds a link inside the media library and submits it to the field. Right now, issuu only offers embeds with fixed dimensions, so they don't scale according to screen width.


texts: Status updates in organic groups disappear after a period of time

texts:
After about 30 days or so, the activity streams under the Organic Group Home tab drop off or disappear. I have found a reference to this issue on Acquia Commons' community site.

I have checked the view activity_log_stream but do not see where we might adjust the length of time which content remains on the activity stream. Optimally, we'd like the content to disappear only after the Items per page attribute is met.


texts:
I'm using Webforms module and, in particular, a Date field. Using built-in validation and intentionally triggering the validation error, the message looks like follows:

The entered date must be 04/04/1914 or later.

Have no error here. What I need is to customize that error message (I need to show (1) a different message, and (2) in a different language).

Question: How can I alter the webform to override the message with my custom one?


texts: Changing generated html of a module. (Search API)

texts:
I need to change the generated html (twig) of the search API module ( https://www.drupal.org/project/search_api ). The Module generates a form having 2 divs with input tag in each of them. I need it to be a form with one div having an input tag and an anchor tag!

What the module generates (in short)

<form>

  <input>

  <input "submit-btn">

</form>

What I want it to be

<form>

  <input>

</form>

So basically, I need to be able to change the submit button to an image so I can place by "position:absolute" at the end of the first input field.

The search API module doesn't have the templates folder or any .twig files than I can overwrite. AND if I do overwrite the base theme form twig files that are used by the module, I cannot do it so that it changes only for this module and it doesn't change all other forms.

I am using drupal 8 btw.


texts: Attach custom css library to entity print output

texts:
I need to attach custom css library so entity_print module uses it to generate the final PDF.

The goal is to get custom css effect the generated PDF at  /print/pdf/node/{{NID}}

I have set the PDF engine to mpdf under entity print configuration

I tried the following 2 methods unsuccessfully :

Attach to node.html.twig file using {{attach_library('THEMENAME/library_name')}}
Attach it to entity_print at THEMENAME.info.yml file per described at https://www.drupal.org/node/2706755

I don't see the attached css at /print/pdf/node/{{NID}}/debug when inspecting elements

Any help or pointers are appreciated.


texts:
I make a quiz with quiz module and the start date is 1/8/2013 4:30 and the close time is 10/8/2013 4:30.
In the database it stored as this=>

1375315200(quiz open)
1376092800(quiz close)

which one is year, month and day?


texts:
How i Display Custom_Block ONLY if User Subscribe to OG..?
So the block can be seen only for (Users Who subscribe)..

UPDATE:  How i alter the subscribe og link? To valadite it..


texts:
I added the webform_multifile to my webform and I configured it as a required field.

But even if I do not download files, the form validates correctly.

And if I download image, I can't find it in my sites/default/files/webform neither in my data base..

Any idea please? Thank you!


texts: Drupal Commerce: Add content nodes to checkout steps

texts:
We have a number of checkout steps that have some content in them that can only be edited via templates which is not ideal for clients.

Is it possible to create content nodes in the CMS that can then be used on the checkout?


texts:
I have a Resource content type that has an image field (field type and widget are both 'image'); the standard image type.  The title of this field is 'Icon' and the machine name is 'field_icon'. I created my teaser so that the title, date, image, and description fields show and customized my search-result.tpl.php and template.php files so they are displaying the teaser/snippet. That works fine.

However, now I'd like to be able to format the returned results a bit more. I see how I can put HTML directly in the .tpl file, fine. But I want to customize the image field so it appears to the LEFT (float or align left) of the other returned teaser elements.

My problem is I can't figure out how to get the variable that represents the image so I can manipulate it in my .tpl file. I tried the following, but it just returns the number to indicate there IS an image or not:

$result['node']->'field-icon';

Can someone please tell me how to get the proper variable or link to the icon itself so I can manipulate it in my .tpl file?

Thank you.

Note, here's my current search-result.tpl.php code:

<li class="<?php print $classes; ?>"<?php print $attributes; ?>>
  <?php print render($title_suffix); ?>

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


texts: How to revert a view that has pending changes in temporary storage?

texts:
I had a working view.
I have tried to modify it by removing the the relationships then it crashes.
Now I am not able to edit the view.

How to revert back the previous changes of view.

Here is the error appearing in edit page of view

Notice: Undefined index: field_product_overview in Drupal\views\Plugin\views\HandlerBase->getEntityType() (line 700 of core/modules/views/src/Plugin/views/HandlerBase.php).
Drupal\views\Plugin\views\HandlerBase->getEntityType() (Line: 250)
Drupal\views\Plugin\views\field\EntityField->access(Object) (Line: 1047)
Drupal\views\ViewExecutable->_initHandler('field', Array) (Line: 898)
Drupal\views\ViewExecutable->initHandlers() (Line: 1230)


texts: Image field unlimited values doesn't save just the first image..the others disapear on save

texts:
I have a weird problem that appeared with my latest drupal installation
I have a content type with some image fields that have an unlimited value (I can upload more images to the same field)
When I press SAVE only the first image remains saved..the other ones..don't
No error is given..
Nor on screen nor on logs..

my drupal version is 7.8
memory limit 96M
Apache/2.2.13 (Unix) mod_ssl/2.2.13 OpenSSL/0.9.8g PHP/5.2.11 with Suhosin-Patch
Mysql 5.1.38


texts:
I've got a problem translation my site title with the Configuration translation module. I set my set title to let's say XXX which is not displayed by the tamplte at all. Instead, it always attaches "| Drupal" string to the end of the node title.

When I click to add translation, translate the string to let's say YYY and save the form, everything appears to be saved correctly, the English version of my site even displays the correct title. However, the form for adding Site information translation still displays an "Add" button as if nothing had been added before and the default version of the site continues to display the "| Drupal" string even though my site name is set to XXX.

Has anybody else experienced the same behaviour?


texts: pager_query() - How to fetch only 100 records with a pagination 10 items per page?

texts:
$result = pager_query($query, 10, 0, NULL, $args);

Currently with above code , I am getting all results with 10 items per page. But I need to display only first 100 records , with 10 items per page. Is this possible with pager_query()  or any alternate solution using plain PHP and MySQL?


texts: Is it possible to update module provided configuration schema in an hook_update_N()?

texts:
So I have a custom module with a module.schema file, defining a configuration schema for that module, not talking about database/field schema.

module.settings:
type: config_object
label: 'Settings for Module'
mapping:
  my_ids:
   type: sequence
   label: 'Ids from config'
   sequence:
    type: string
    label: 'ids'

I provided a module.settings file like:

my_ids:
 - 1
 - 2
 - 3
 - 4

As you can see, my mistake is that I needed a type: int in my schema not type: string.

On the configuration synchronization page I see Drupal has taken care of this and corrected this in its active configuration, by setting string values for "my_ids", and of course producing a diff between the staged and active configuration. The active conf has now strings:

my_ids:
 - "1"
 - "2"
 - "3"
 - "4"

I would like to update the schema of that configuration to int, without re-installing that module.Is this possible.

Tried to write to schema service in an update hook like:

  $name = 'module.schema';
  $path = '/home/user/Drupal/docroot/modules/module/config/schema';
  $source = new FileStorage($path);
  /** @var \Drupal\Core\Config\ExtensionInstallStorage $active_schema */
  $active_schema = \Drupal::service('config.storage.schema');
  $active_schema->write($name, $source->read($name));

But it turns out that "Write operation is not allowed." and that does not sound like a surprise.. :)

So is there another solution for this schema update, except re-installing the module?

Thank you.


texts:
I have been trying to understand how to accomplish this for quite some time.  And I'm not getting anywhere. The info I'm finding seems a bit dated.

Can anyone tell me where to start to get this accomplished?

I am looking to migrate only products.  Nothing else.  The new site will be a fresh start other than product/inventory.  And with some 1500 products, I really need a migration process.

Is there a template for Commerce Ubercart Migration that I am missing?

Thanks.


texts: Add description and title field to each image

texts:
I am creating an image Album. For this I have created one content type with "Album Title"(title), "Album Description"(body) and Image field which can take unlimited number of images. Now I want to add a title and description to each image.
Please help me to short it out.


texts: How do I redirect to an external URL in new tab by using RedirectResponse or TrustedRedirectResponse?

texts: I need to use TrustedRedirectResponse on my site and open the external url in new tab?How can it possible in drupal 8


texts: What is the best way to achieve this result?

texts:
I've hit a bit of a stumbling block with how to tackle this design I'm working on in Drupal. The end result needs to be a block that sits on the home page and it updated weekly by anyone with the 'staff' user flag.

This is what it needs to be in the end: http://i.imgur.com/XUZugT4.png (Data being the focus of this question, design is irrelevant):

Whoever generated the list has their name and picture on the block.
There will always be 3 products.
The person who picked this week can include a personal comment on the picks.

I've been able to get it working so far by making a block that uses inline PHP to grab a view that contains 3 products that have the taxonomy term "Promote to Front Page", and then manually filling in the user information myself... But I'd like for this to be something a staff member can fill out themselves without needing any code knowledge.

Is this something achievable with a content type or something else i'm not thinking of?

An awesome bonus is if there's a way to do it so that each week a new pick is generated but the old ones are still stored for reference.

Thanks muchly!


texts: How to get node url from Entity Reference field?

texts:
We have an ECK Bundle that has an Entity Reference to Article and Basic Page content type. In the twig template we are using the following line below to get the node's nid value and then using that in the twig template to create a link to that node. However, we are getting the following error message while logged out (for logged in users it works fine).

How can we get the node's url for both anonymous and logged in users?

Twig template (eck-entity--component--eck-ref-node--default.html.twig where eck-ref-node is the eck bundle name):

{% set field = entity.field_eck_ref %}
{% set ref_node = field.0['#node'] %}
{% set nodeId = ref_node.nid.value %}
{% set nodeURL = path('entity.node.canonical', {'node': nodeId}) %}

<a href={{ nodeUrl }}>
...
</a>

Error:

  Uncaught PHP Exception
  Symfony\Component\Routing\Exception\InvalidParameterException:
  "Parameter "node" for route "entity.node.canonical" must match "\d+"
  ("" given) to generate a corresponding URL."


texts:
When working with an Event content type and creating an Events Calendar using views, is it best to keep the date and time separate or together? I was thinking of having them separately, but there is no Time field type, and if I select the content type of Date for the Time only, it messes things up, in a sense that it also requires a date, which conflicts with my Date Field. :S

The reason why I want to separate the Date from Time is because I only want the time to displayed in the calendar view.

Any tips would be greatly appreciated.


texts: What's the workflow behind [user:display-name] token?

texts:
I have seen in an email template, a token named [user:display-name]. Further noted that this token is not global, its value will only get rendered in email templates (correct me if I'm wrong).

How these specific tokens specially designed for only email tokens have been created?

In which file its logic is been written, I'm so curious, as the current user does not store any value of email receiver to whom email has to be sent. Then from where it picks the value of display name when current user is sending mail.


texts:
I need to create several nodes of the same type and all have to have an image carousel similar to what flexslider does in Views.
I already deleted the Views example but cannot replicate the behavior in a field in spite that I formatted the field with flexslider full, I just get the images displayed one below the other.


texts: Select groups to relate the node to directly in the node creation form

texts:
An admin who wants to relate a node to a group can go to the group and then create a node from there (/group/{id}/node/create) . The node is then assigned to the group.
Or she can assign a already created node (/group/{id}/content/add)

What I need is a way to relate a node to one or multiple groups directly when creating it.
Is there a module to do this or some documentation to get me started in developing it?


texts: How to disable an alias path (for an unpublished page)?

texts:
As path aliases now seem revisionable (from 8.8.x, see Convert path aliases to full featured entities) what is the best way to set an unpublished page (that was unpublished by a content moderation—as per accepted answer in How to unpublish content that is under moderation) to not have the alias enabled? This seems to be what the status field is for, so what code should be used to set this when I know the entity (or is there already an existing module that does this when a page is unpublished)? Does cache need to be invalidated after status field change too?
Of note, the desire is to effectively remove all traces of a page from public view (i.e. for an anonymous user) but the page's history needs to be kept for retention/record keeping purposes, so hence the requirement to only unpublish the page (and not delete it, which would remove the alias record). If the alias isn't disabled for an unpublished page (like it is by default) then users are taken to the login page, thus not achieving the "remove all traces of it" goal. I understand authenticated users probably won't be able to access this page by its alias path with status set to 0, but this is an acceptable (even preferred, for consistency) outcome.
Thanks


texts: Create a menu based on taxonomy terms, first level being a drop down select, last level being the content type

texts:
Fairly new to Drupal. I made some sites in D6 ages ago and D7 is totally new to me.

I'm about to do a small site with a hierarchical menu where the visitor can put items from the different markets/categories in a cart to checkout.

The menu should consist of a dropdown select where the user first selects the market of his choice.
Underneath it there should be a menu listing of categories and subcategories like this:

[Market] (drop down menu with a lite of countries)

-- Product catergory 1 (submenu expanded by default)
----- Banners (this submenu opens a page that lists content of type "banner" for selected market/prod.category)
----- Events
----- Campaign sites
-- Product catergory 2
-- Product catergory 3
-- Product catergory 4
I'm not sure how to go about doing this. I was thinking making 2 taxonomy vocabularies.
Markets is one vocabulary listing a couple of countries.

And then another vocabulary named Products, listing the different product categories.

When I create a new content type I first mark it with one or more markets it's available in. And also what product category it belongs to. The content itself is of the type shown in the menu example above (banner, event, capaign site or whatever).

Maybe this all can be done in views or multiple blocks or something, suggestions would be greatly appreciated.


texts: When I create a group, the HTML around the group title isn't parsed. Even if I change those tags, it isn't parsed. Is there some filter I'm unsure of the whole page is running through or is this some sort of bug with   the Group module?


texts: "View recent blog entries" only showing on admin's page but other users have blogs

texts:
"View recent blog entries" only showing on admin's page:

http://www.effectiveanimalactivism.org/user/1

But other users also have blogs:
user/5
and /user/10

that don't show up on their user pages.


texts:
Anything I could find related to this question was for Drupal 7.

I am building a form that needs to perform a certain ajax function when a date is selected. I have built my form to work similarly to the "Form API Examples - Ajax Form Example" part of the Examples module.

To test, I set it up so that, like in the example, when this Select element is changed it triggers the function "dateCallback":

$form['dropdown'] = [
    '#title' => $this->t('Test'),
    '#type' => 'select',
    '#options' => ['option1' => '1', 'option2' => '2'],
    '#ajax' => [
        'callback' => '::dateCallback',
        'wrapper' => 'log-wrapper',
    ],
];

This executes perfectly.

However, when I try to set up a Date element to do the same function, nothing happens. No Ajax spinner, just nothing happens at all.

$form['date'] = array(
    '#type' => 'date',
    '#title' => t('Date'),
    '#ajax' => [
        'callback' => '::dateCallback',
        'wrapper' => 'log-wrapper',
    ],
);

It does not work even if I include 'event' => 'onchange' in the #ajax array.

Is it possible to make ajax functions trigger on a changed date field?


texts: Checking Available Update data - AJAX error

texts:
I'm having problems with a local site that I imported to Acquia Dev desktop from one of my live sites.  Everytime I try to Check for Available Update data, I get an Ajax error

  Error Checking Update Data Please Continue to error page An AJAX HTTP
  request terminated abnormally. Debugging information follows. Path:
  /batch?id=676&op=do StatusText: ResponseText: ReadyState: 4

Clicking the error page link, drupal returns me to the available updates page with a message

  An error occurred trying to get available update data.

Any ideas?

Thanks
Sharon


texts:
I want to pass a variable from a mymodule_preprocess_node(&$vars) to my template file.
Something as simple as the following:

function mymodule_preprocess_node(&$vars) {
  $vars['node_type'] = 'some_type';
}

I trying to pass this variable to a zone--content.tpl.php file.

PS: Cleared all the caches :)


texts: How can I get module configuration for testing

texts:
I write tests for a form in a custom module using Drupal\simpletest\WebTestBase. I want to test, if the module settings are displayed in the configuration form. But the problem is, that I can not get the saved settings:

$config = $this->config('mymodule.settings');
debug($config->get(), 'Configuration object'); // Returns an empty array

I have found, that the same problem is e.g. in the demo module described in an article  on Sitepoint, see: https://github.com/upchuk/d8-demo-modules/blob/master/demo/src/Tests/DemoTest.php#L59

  E.g. $config->get('demo.email_address') returns always ''.

The tests seem to work well, but when I add debug($config->get()), then I also receive an empty array. It means, that all the test cases use empty variables and return false positive results.

I have also tried:

debug(\Drupal::config('mymodule.settings')->get()); // Empty array
debug(\Drupal::configFactory()->getEditable('mymodule.settings')->get()); // Empty array
debug(\Drupal::config('system.site')->get()); // Correct array with site settings

The module and the form are working correctly and all the settings are stored in the database.


texts:
Is it possible to add a unique id or class to each li element in a menu, perhaps using a preprocess function? I want to be able to target each menu item individually with CSS.

I could probably use css rules like li:nth-child(1) etc, but I would rather add a unique ID or class to the element.


texts: Add Is-Active class on custom link in view

texts: How can I add Is-Active class on custom link path in view. I have created block of taxonomy term name and format is Grid view. I have added field "Name" and in its configuration given custom path link. So when user click on name in page is-active class should add. How can I achieve this in view. Please check attached images.


texts:
I have a migration use case where I can't figure out a way to get along with:

I have a Drupal 7 site which shall be migrated to D8. I don't want to migrate the content 1:1 but rearange some things to better fit the D8 way.

In the old site there are products which have an "ingredients" field which is a reference to taxonomy terms. Additionally there are "griege" nodes which technically represent an ingredient but are not associated with the taxonomy vocabulary "ingredients". They have indeed the same title so could be mapped by string comparison.

Now I want to do the following:

Import all "Griege" nodess from the old site and save them as
"Ingredient" nodes
Import all "Product" nodes to the new site
Check if they have ingredients (taxonomy terms) assigned
If so, search for "Ingredient" nodes in the new site (term name == Ingredient title) and attach them to the newly created "Product"

In short I want the assigned taxonomy terms to be converted into "normal" content entities.

What I did so far is to extend the Drupal 7 node source plugin by adding the following left joins within the query() method:

$query->leftJoin('taxonomy_index', 'ti', 'ti.nid = n.nid');
$query->leftJoin('taxonomy_term_data', 'ttd', 'ttd.tid = ti.tid');

My problem is that I don't know what to do with that information within the process plugin. I could return the correpsonding Ingredient ID but as it's an 1:N relation between Prdouct and Ingredient that would mean it would overwrite the array holding the product ingredients everytime I process a row.

I hope my problem is somehow clear... :/

Some general questions I have:

Is there a way to access the datasource (the D7 source database) within a process plugin? E.g. do a select on the old product (get all terms, do the lookup in the new DB and return an array of Node Ids)
Could my solution somehow involve the usage of a destiantion plugin (I haven't fully understood the usage of those I fear)?
Is there something completely different I missed out to do the job?

Many thanks in advance!

Dennis


texts:
I ran composer global require drush/drush:8.1.3 and added C:/Users/username/AppData/Roaming/Composer/vendor/drush/drush to the value of the PATH variable.

drush status returns the following output.

 PHP configuration      :  C:\xampp\php\php.ini
 PHP OS                 :  WINNT
 Drush script           :  C:\Users\username\AppData\Roaming\Composer\vendor\dr
                           ush\drush\drush
 Drush version          :  8.1.3
 Drush temp directory   :  C:\Users\username\AppData\Local\Temp
 Drush configuration    :
 Drush alias files      :

When I change directory to the one containing the Drupal files, and I run drush status, I get this error.

  'C:\xampp\htdocs\drupal-project\drush' is not recognized as an internal or external command,operable program or batch file.

Why?


texts:
I have a view with td grid style and two fields: views-field-field-foo-image and views-field-field-foo-title.

The image is linked with colorbox load and the structure of the HTML is like this:

    <a class="colorbox views-ajax-processed-processed"....

How can I put the foo-title into the foo-image field, so the structure to become like this?

        <a class="colorbox views-ajax-processed-processed"....

With views module by changing the order of fields, so the title become on top and with Rewrite results/Rewrite the output on the image field will be possible to change the structure, but I cannot understand the building process with tokens.

EDIT: Unfortunately the answers didn't helped me.

Here's an example http://www.mtv.co.uk/the-valleys when you hover on any latest video, you'll see the title.
This is their structure:

Exclusive

I want to add that
 inside the link, or in my case the title field.
That's what I want to achieve.

I can see they don't use views. If someone knows how to create that even without Views module, please let me know.


texts:
Taking a look at function comment_save() from comment.module, I can't understand how Drupal avoids duplicates when getting $max value on this statement:

$max = db_query('SELECT MAX(thread) FROM {comment} WHERE nid = :nid', array(':nid' => $comment->nid))->fetchField();

Even the query is in a transaction, a select query is non-blocking and two users posting a comment simultaenously can get same thread value.

Moreover, table comments allows duplicates on thread field so no exception will be fired in case of duplicates.


texts: Showing a list of content that only authorised users can see

texts:
Most of the site is public however certain nodes need to be only visible to authorised users. I've got this up and running using Content Access but now I want to show a list of content that Anonymous users can't see.

I thought I'd be able to do it using Views and Contextual Filters but I can't seem to get just that content to show.

So, how do I do it?


texts: How do I structure a simple Drupal 7 site/theme?

texts:
I'm coming from WordPress CMS and right now (to be honest) I'm a bit overwhelmed by the (seemingly) complex Drupal theming/content management system.

I have a website with the following pages (I've simplified it a bit but that shouldn't be a problem):

Home (contains 3 containers with text/lists that should be editable through the CMS)
About (editable text)
Jobs (lists all available job offers, also editable)

I want to start my theme from scratch. I have my html.tpl.php where I have title and meta stuff; then I have the page.tpl.php with my layout. That layout is the same for every one of my pages; the only thing that changes is the content inside my content-div.

How and where do I code the structure for my "Home" page? Is every editable text container a region to which I assign a block I created? Is my "Home" page basically a node whose code should be in a extra node--[home].tpl.php file?

I googled a lot, but I couldn't find good instructions on starting a theme from scratch. All the tutorials I found only changed some basic things in a theme or did sub-theming but there was nothing that could show me how to structure my site.

Maybe someone can help me or point me to a good tutorial; coming from a WordPress background i'm very confused right now.


texts: Drupal sites extremely slow due to cache SELECT-queries

texts:
I have multiple drupal 7 sites running on my shared hosting. Suddenly almost all of my drupal sites began running very slow. After some searching I found that I had 132k slow queries of the 140M queries executes.

So I turned on de debug query option in the Devel module and got this:

Executed 230 queries in 18868.24 ms. Queries exceeding 5 ms are highlighted.
Page execution time was 21632.34 ms.
Memory used at: devel_boot()=2.61 MB, devel_shutdown()=47.54 MB, PHP peak=48 MB.

After looking at the SELECT-query list I noticed that there are a lot of cache-queries that run slowly:

SELECT cid, data, created, expire, serialized FROM cache_views WHERE cid IN (:cids_0)

Not only for 'cache_views' but also other cache-tables:

cache
cache_field
cache_filter
cache_menu
cache_bootstrap
...

In PHPMYADMIN I also notice that a lot of queries have been removed from the cache:

Qcache_lowmem_prunes: 35.2M (of 143M queries)

I already checked if there were modules enabled in the DB but deleted on the drupal site.

I hope this is enough info to get some help.


texts: exclude contextual filters from breadcrumb

texts:
I'm having a bit of a problem here.
I have a view which contains a list of items. At the top there are some vocabulary terms which you can click. When you click you go to a next page which shows a filtered list.

The problem is, on that new page, the filters are being added to the breadcrumb which I don't want. How can I exclude these filters from the breadcrumb?

example
The page with the complete list has this breadcrumb, which is good:
Home » Opleidingen » Bijscholing

Next, if we click on 'gasten, hoe gaan we er mee om', the list gets filtered with the word 'gasten', on the next page the breadcrumb is like this:
Home » Opleidingen » Bijscholing » Gasten, hoe gaan we ermee om? » » gasten » gasten

I want to be able to exclude this part '» » gasten » gasten'


texts:
I am using a menu_block block that displays sub-menus depending on what page the user is. on some pages, there are no sub-menus, so my menu-block is automatically hidden by drupal. how do i force drupal to display my block even if it is empty?

thanks.


texts: I need to display a different link for anonymous users and register users for same content

texts:
I have a webform containing a link. I want to change the link depending on the users accessing the webform.
For anonymous users, the link should point to user/register?destination=[current page]; for authenticated users, the link should point to form/event-registration.


texts:
I would like to hide this field if it is empty. No clue where to start with my limited PHP/Drupal knowledge. The Else would be "Nothing to see here."

<?php

  $my_field_value = $content['product:field_course_no_']['#object']->field_pd_number['und'][0]['safe_value'];

echo "<input type=\"button\" value=\"Danh's Cart\" id=\"Adding PDC course\" onclick=\"setCookie('class','$my_field_value" . "r_000000000000');document.cartform.submit();\" style=\"float:none;\" /><input type=\"hidden\" name=\"id\" value=\"$my_field_value\" />";

?>


texts: Node content not available to anonymous users

texts:
I'm having some trouble with viewing my nodes as an anonymous user. When not logged in as admin, I am still able to access the URL of the node, but the content (other than the title) is blank. I've spent a lot of time looking around the permissions, but I can't seem to resolve this issue. The problem exists when accessing the node directly or through a view.

The below example uses nodes with the Link field type, but I'm also having the same problem with my text and file fieldtypes.

This is what displays in a particular view as anonymous:

The same view, logged in as admin:

Hopefully an easy fix, any recommendations would be great!


texts: Is it possible to display a field value as part of Views title?

texts:
I'm building a block in Views where different brands show off their respective products, now I'm wondering if it's possible to pass a field value to the title.

I know that %1 results in displaying the title

I've tried searching for a solution, but fail to find one as I'm not that familiar with the terminologies of Drupal (as in I don't really know what specifics to search for). This might be super simple, but I can't seem to find the answer and if possible it could become pretty useful in the future.


texts: Send email with html template programmatically

texts:
On board:

Drupal 7
Mail System
Mime Mail

mimemail-message.tpl.php is configurated

E-mails sends by Rules with HTML template, but template not used when it call programmatically:

$mail = array(
  'subject' => 'Test e-mail',
  'message' => '

Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy <s>nibh</s> euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.

  ',
);
drupal_mail('system', 'mail', 'to@example.com', language_default(), array('context' => $mail));


texts: Single value "db_query": How to SELECT value that related to the node

texts:
From this page, if what we need is SELECT single value, we can use fetchField method like below:

$nbr_records = db_query("SELECT count(nid) FROM {joke}")->fetchField();

I've created single value Integer field type with machine name field_subscription_period attached to node type yearly_rent.

I'm using this in Rules Action.

I've tested many db_query example with no luck.

Below is what I'm using, which it will get value of entity_id 2:

$result = db_query("SELECT field_subscription_period_value FROM {field_data_field_subscription_period} WHERE entity_id = 2")->fetchField();

Above query will get value of entity_id 2... but I want to SELECT field_subscription_period value that related to the node. So, how to get value that related to the node?

-newly added-

I still don't understand how to use $node = node_load($nid);. Lets say I want to use the value as variable to be calculated in date field.

I've tried below with no luck:

$node = node_load($nid);
$values = field_get_items('node', $node, 'field_subscription_period');
$newdate = strtotime("+$values year","$value");
return $newdate;

..and also I got error:

Notice: Undefined variable: nid in eval() (line 1 of /var/www/testd7/sites/all/modules/rules/modules/php.eval.inc(146) : eval()'d code).
EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7539 of /var/www/testd7/includes/common.inc).


texts: How can I control file renaming behavior of Drupal 7 Webform file uploads?

texts: I'm a drupal newbie so excuse me if I'm using the incorrect terminology or my description is not very clear. I have a webform with a file upload field using the File widget. I upload files for users to download. When I upload a file to the webform and save the page, drupal adds a _X (where X is a number) to the file name just before the extension. For e.g if I upload myfile.tgz, drupal renames the file myfile_0.tgz. This can be quite annoying especially for tar files that auto install because users have to rename the files manually after downloading. I have gone to 'Administration-->Content Types-->Webform-->Manage Fields-->File' to make sure all the extensions I want to allow (tgz, tar.gz etc.) are enabled but this doesn't prevent the renaming. This happens even when there's no file with the same name already existing. How can I prevent this?


texts: How can I allow users to add a reason for a flag?

texts:
I have the Flag module installed on my Drupal 7.8 site, but I can't figure out how to allow users to submit a reason for a flag along with the flag. I've tried looking this up, but the only thing I could find was the Flag Note module, which is only compatible with earlier versions of Drupal. What I want to have happen is:

User goes to a node, and notices it's not accurate
User clicks the "Report inaccuracy" button, and some sort of text field pops down below it
User fills out reason it's inaccurate, and submits it
Then I can have it be displayed in some stylized div at the top of the page when anybody visits it, similar to the Wikipedia sort of tagging wiki pages thing.

Does anyone know how I could do this? If there's a module that will let me implement the Wikipedia page tagging style of thing without needing a "flag note", that would work perfectly too.

Thanks!


texts: How can I add additional query parameters to a view title linked to a node?

texts:
I have a view (using the calendar module), which displays a title field for each displayed event. The title field is set to "link this field to the original piece of content".

I'd like to rewrite that link to add some additional parameters, e.g. ?return_view=myview, so that I can link back to the view page from the content. The content might be linked to from any one of several different views, so it needs to take some parameter (i.e. return_view) to tell it what to link back to.

I've tried adding a hook_views_pre_render:

function mymodule_views_pre_render(&$view) {
    if ($view->name == 'myview') {
        foreach ($view->result as &$r) {
            $r->node_title = array(
                '#theme' => 'link',
                '#text' => 'xyz',
                '#path' => 'node/' . 123,
                '#options' => array(
                    'query' => array(
                        'rv' => $view->name,
                        'rvd' => $view->current_display
                    ),
                    'attributes' => array(),
                    'html' => FALSE
                )
            );
        }
    }
}

But that just leads to Drupal complaining that "warning: htmlspecialchars() expects parameter 1 to be string, array given in check_plain()" - I'm assuming because some rendering function somewhere expects to get a plain string.

What's the cleanest way to add additional query parameters to a node title rendered by views?


texts:
i use drupal 7 with Commerce module installed. I am searching a couple days to find out a way to change (alter) the presentation (theme) of Checkout page. I mean the first page that someone visit after pressing Checkout button. (Not the review or payment pages).

What is trying to do, is to have only the cart contents on top and below that i want to create a tab system with the following tabs:

Login
Create Account
Complete checkout as a guest

So i need to hide the billing or shipping or any other pane and make them visible only on the third tab.

I think i have some pieces of the puzzle, for example i have tried creating a custom module and playing with hook_commerce_checkout_pane_info_alter to unset some panes and hook_form_commerce_checkout_form_alter to create panes programmatically but i am lost in space...

Another puzzle piece, is the php code of the login form for the first tab(Login) for example:

<?php
   $elements = drupal_get_form("user_login");
   $form = drupal_render($elements);
   echo $form;
?>

I may need your help to make things clearer. I need to reorder panes, add some custom html and javascript to create the tab system and bring some forms there. Where is this canvas, the template that loads everything so to bypass that and create my own ? Where do i have to look, search and study ?

Thank you :)


texts: rewrite with nginx conf result 502 bad gateway

texts:
My code is based on http://wiki.nginx.org/Drupal and the result is 502 bad gateway. I have tried so many ways but dont work.... how  i can solve this? thanks

server {
        listen 8093;
        server_name localhost;
        root /home/ITEP;

        # Enable compression, this will help if you have for instance advagg module
        # by serving Gzip versions of the files.
        #gzip_static on;

        location = /favicon.ico {
                log_not_found off;
                access_log off;
        }

        location = /robots.txt {
                allow all;
                log_not_found off;
                access_log off;
        }

        # This matters if you use drush prior to 5.x
        # After 5.x backups are stored outside the Drupal install.
        #location = /backup {
        #        deny all;
        #}

        # Very rarely should these ever be accessed outside of your lan
        location ~* \.(txt|log)$ {
                allow 192.168.0.0/16;
                deny all;
        }

        location ~ \..*/.*\.php$ {
                return 403;
        }

        # No no for private
        location ~ ^/sites/.*/private/ {
                return 403;
        }

        # Block access to "hidden" files and directories whose names begin with a
        # period. This includes directories used by version control systems such
        # as Subversion or Git to store control files.
        location ~ (^|/)\. {
                return 403;
        }

        location / {
                # This is cool because no php is touched for static content
                try_files $uri @rewrite;
        }

        location @rewrite {
                # You have 2 options here
                # For D7 and above:
                # Clean URLs are handled in drupal_environment_initialize().
                rewrite ^ /index.php;
                # For Drupal 6 and bwlow:
                # Some modules enforce no slash (/) at the end of the URL
                # Else this rewrite block wouldn't be needed (GlobalRedirect)
                #rewrite ^/(.*)$ /index.php?q=$1;
        }

        location ~ \.php$ {
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
                include fastcgi_params;
                fastcgi_param SCRIPT_FILENAME $request_filename;
                fastcgi_intercept_errors on;
                fastcgi_pass unix:/tmp/phpfpm.sock;
        }

        # Fighting with Styles? This little gem is amazing.
        # This is for D6
        #location ~ ^/sites/.*/files/imagecache/ {
        # This is for D7 and D8
        location ~ ^/sites/.*/files/styles/ {
                try_files $uri @rewrite;
        }

        location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
                expires max;
                log_not_found off;
        }
}

I'm using drupal 7.... fresh install


texts: Now that drupal_add_js(...., 'inline') is no longer possible, how can I inject dynamic Javascript from a custom module's Controller? (I'm trying to upgrade a D6 module with as little refactorings as possible)


texts: Translating strings to English from a second language

texts: It seems that Drupal 7 doesn't provide a function to translate a non-English string to its English equivalent. I'd like to do this for a project I'm working on, but the absence of a reverse-translation function suggests that perhaps I shouldn't. Is there any reason for the absence of a function that translates strings back to English? And how should I achieve this functionality with my project?


texts: View Mode not showing up under Manage Display

texts: I created a view mode let's call as my_node_view for content type under display type settings, I was expecting it to show along with default and teaser tabs as default|teaser|my_node_view in manage display section, but it did not show up. I have ensured my_node_view is checked under custom display settings for Use custom display settings for the following modes. Am I missing anything?


texts: Custom Body of Webform email handler missing text area

texts: When selecting default, I have the html appearing.  Selecting twig will work as well.  Selecting Custom Body changes to a blank area with no way to enter code.  This happens on both lamp and live site. see image


texts: Need to filter events from the current week only

texts:
I am using drupal 7 & views for a simple event agenda website. I need to display content for the current week only. How do I filter those with views? For example, I need to be able to set an event that will show only through week number 36.
thanks!


texts:
I would like to theme a form, and the div wrapping my text input element prevents me from doing what i want. So i got this right now :

<div class="form-item form-type-textfield form-item-email">
 <input type="text" id="edit-email" name="email" value="mail@msn.com" size="20" maxlength="128" class="form-text required">
</div>
</div>

I would like to have this :

 <input type="text" id="edit-email" name="email" value="mail@msn.com" size="20" maxlength="128" class="form-text required">


texts: How can I add a custom price to a cart as an attribute of product type in Drupal Commerce?

texts:
How can I add custom price to cart as an attribute of product type in Drupal Commerce?

In detail am creating a custom tshirt design UI where user have the options to design a tshirt(add image,text etc) and add to cart. I have loaded all the products in the site to the UI and user have the option to add  product to cart after designing. User is charged with an extra amount for designing like adding each images to tshirt which increases the base price of tshirt. But my issue is that the products get added to cart with the base price. I have used the folowing code to add the product to cart.

commerce_cart_product_add_by_id($pid, $quan, $combine = TRUE, $uid);

When I searched and found that there is no way to add the custom price as parameter of the above function so that the altered price gets added to cart. But found another solution that it can be done by adding as an attribute of the product.

How can I  map the custom price I have created as an attribute of the product and add to cart for altering the price section?


texts: Views grouping rows case-sensitive, I need to ignore case

texts:
I have a view which groups rows in a table according to the first letter of the title. Some of the letters are uppercase and some are lowercase. View treats the upper and lower case as separate groupings (see image attached) but I want them to be grouped case-insensitively.

I've checked my db tables are ci and I've tried to alter the query using hook_views_query_alter but haven't managed to find a solution yet.

Thanks


texts:
I'm trying to rebuild the pullquote module in Drupal 8 but am running into an issue accessing view modes. In the Drupal 7 version, the view_modes variable is set by the following lines:

$entity_info = entity_get_info('node');
$view_modes = $entity_info['view modes'];
$view_mode_options = array();

foreach ($view_modes as $mode => $settings) {
  $view_mode_options[$mode] = $settings['label'];
}

However, entity_get_info() has been depreciated in Drupal 8, and according to the documentation I found, replaced with \Drupal::entityTypeManager()->getDefinition().

So I tried replacing the first line:

$nodeEntity = \Drupal::entityTypeManager()->getDefinition('node');

but the array was empty, so maybe I'm using the wrong tool.

I then found this answer for accessing a list of all view nodes.

$view_modes = \Drupal::entityQuery('entity_view_mode')
  ->condition('targetEntityType', 'node')
  ->execute();

It worked, however, they were returned like this:

['node.full', 'node.rss', 'node.teaser']

But here's the problem. I'm using these view modes as options in a form. When the form is saved in configuration, having a key with a period breaks the YAML file with the following error: The website encountered an unexpected error. Please try again later. Drupal\Core\Config\ConfigValueException: node.full key contains a dot which is not supported. in Drupal\Core\Config\ConfigBase->validateKeys(). I'm confused though, because I map over the array so that I'm stripping the names of ".node"

Here's my full code for reference:

// Load the list of avialable view modes.
$view_modes = \Drupal::entityQuery('entity_view_mode')
  ->condition('targetEntityType', 'node')
  ->execute();

// remove "node."
$view_mode_options = array_map(function ($mode) {
  $parsed = substr($mode, 5);
  return $parsed;
}, $view_modes);

$form['view_mode_settings']['pullquote_view_modes'] = [
  '#type' => 'checkboxes',
  '#title' => t('View Modes'),
  '#options' => $view_mode_options,
  '#default_value' => $config->get('pullquote_view_modes'),
  '#description' => t('Choose which view modes will load pullquote code and render pullquotes. For better performance you should only load pullquote where you need it.'),
   '#states' => array(
     'visible' => array(
       ':input[name="pullquote_load_by_view_mode"]' => array('value' => 1),
       ':input[name="pullquote_scope"]' => array('value' => 0),
     ),
   ),
];

Now the view modes display properly on the page, but I still get the error that Drupal can't save "node.full" in configuration, which is confusing because the page displays only "full."

Is there a method for getting the label of different entity types? Or is there a way to actually parse "node.full" down to a string that is only "full"--both when it displays and how Drupal understands it?


texts: Automatically fill in the subject line of contact form

texts:
Is there a way to automatically fill in fields in Drupal 8 Contact forms, for example by passing the value in the URL? E.g.

/contact/myform?subject=Subject%20line

If Drupal doesn't have this built-in, does anyone know of a javascript plugin that will do this?


texts:
I am working in one of the project using the Flag module. I want to add custom event when user flag any content. I am trying to use hook_flag_flag() but it is not working.
This is the code I am using in a module file.

use Drupal\Core\Form\FormStateInterface;
use Drupal\node\Entity\NodeType;
use Drupal\flag\Plugin\Flag\EntityFlagType;
use Drupal\flag\FlagInterface;
use Drupal\flag\Event\FlagEvents;
use Drupal\flag\Event\FlaggingEvent;
use Drupal\Core\Session\AccountInterface;

function nppe_custom_flag_flag( $flag, $entity_id, $account, $flagging) {
  drupal_set_message("This is custom message after Flag.");
}

Is there anything I am missing?


texts:
In node--article.html.twig

<article{{ attributes.addClass(classes) }}>
  {{ created.content | date("d/m/Y") }}
  {{ content.title }}
  {{ content.body }}
</article>

The title is not displaying. How do I do this?


texts:
I'm getting to grips with Drupal 7 at the moment. One thing that I'm finding frustrating at the moment (perhaps because I'm misunderstanding) is blocks.

Can you not just have a blank block give it a template and do what you want? I'm creating a sub theme off of Bartik and would like to put the main navigation into it's own block (to keep things tidy) and then just call the region this block is set but this doesn't seem to work. It seems I have to have the body text from the block included and the navigation doesn't seem to work either. I have come from developing in wordpress which has the loop, if you're in the loop you can call what you please, but this doesn't seem to be the case for Drupal?


texts: Creating custom field with Display Suite and Profile 2

texts:
I am trying to use Display Suite (newest version) to format the profile page for users. I am using the Profile2 module and the default main-profile type. I have the user's full name (not username) split into the fields for first, middle, and last. I am trying to create a custom field to combine these three fields as the full name.

I am trying to create a code field but I don't know what variable or replacement pattern to use. There is nothing in the list of available tokens. I have tried php using $content and $entity and get undefined variable errors.

How can I create a custom field in Display Suite to combine these three fields from a Profile2 entity?


texts: Adding a #suffix to a Drupal Product Form Payment Method Radio

texts:
I have two radio buttons in my Drupal 7 product form. One for credit card and the other for 'send an invoice'. I'd like to add some text after each option but I don't know how.

In my hook_form_alter module this is what I'm attempting:

$form['commerce_payment']['payment_method']['#options']
['paypal_commerce_payment_paypal_wpp']['#suffix'] = 'text here';

However, this keeps throwing an error:

Warning: strlen() expects parameter 1 to be string, array given in
drupal_validate_utf8() (line 1599 of
/var/www/checkout/includes/bootstrap.inc).
Notice: Array to string conversion in format_string() (line 1550 of
/var/www/checkout/includes/bootstrap.inc).

And under the two radio options it just says 'Array' next to yet another radio button. Obviously not what I want. I want the text 'text here' to appear right after the 'Credit Card' radio option.

I also tried targeting the 'suffix' with '#field_suffix' to no avail.

Any idea how to make this happen?


texts:
I have a node page that should redirect to another node's page instead of displaying itself...

How can I do that ?

Many thanks !


texts: Hook for a JS library in a custom module not working drupal 8

texts:
Well I have created a JS to validate a form, and when I try to attach the hook in my custom module the JS its not showing. My custom module it's call "ajax_form"

My ajax_form.libraries.yml

ajax_form:
  version: 1
  js:
    js/ajax_form.js: {}
  dependencies:
      - core/jquery

My ajax_form.module

<?php
function ajax_form_page_attachments(array &$attachments) {
    $attachments['#attached']['library'][] = 'ajax_form/ajax_form';
}

I have a console.log('test'); in the first line of my JS but this is not displaying.

I have run out of ideas of what it be. Also I'm new to Drupal maybe is that.


texts: How to migrate Webform data from Drupal 6 to Drupal 7?

texts: I have a Drupal 7 installation with the Webform module enabled. I recreated a Drupal 6 webform and now want to migrate data from the Drupal 6 installation to the Drupal 7 installation. Is this possible?


texts:
I am in the process of writing my 3rd custom module and this one is my biggest challenge yet.
I know how to use hook_menu to generate menu items, and depending on the path you choose determines where they show up on the site (administration menu or main menu, etc).

My question is - how do I specify a NEW menu, so that the paths I create do not appear in "primary links" or "navigation" but in their own "custom module" menu?


texts: How to sort view search results by giving custom relevance weights?

texts:
I am using Drupal 7.43 and core search module.

I use "Search: Search Terms" for filter criteria and "Search:Score" Sorting criteria in my view to sort my results according to relevance.

But, for example if I search for text "drupal view search" it prioritize some node containing word "drupal" 5 times over a node containing all the text I entered, "drupal view search".

I want to sort my results such that, prioritize nodes that have title as the text I entered,then nodes that have any of the words in title, then nodes that have that text in the body.

How can I customize and add more functionality to the content ranking part in this page /admin/config/search/settings?


texts: Adding an image base field to custom content entity

texts:
consider the following situation: I have created a custom content entity with several base fields (string and string_long fields) and it works flawlessly. In addition I want the entity to hold an image field which I defined the same way I did with the other fields:

public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {

    …

    $form_options = array(
        'type' => 'string',
        'weight' => $key,
    );

    $view_options = array(
        'label' => 'hidden',
        'type' => 'string',
        'weight' => $key,
    );

    …

    $type = 'image';
    $settings = array();
    $form_options['type'] = 'image_image';
    $view_options['type'] = 'image_image';

    …

    $fields[$fieldname] = BaseFieldDefinition::create($type)
        ->setLabel(t($sections['labels'][$key]))
        ->setDescription(t($sections['descriptions'][$key]))
        ->setSettings($settings)
        ->setDisplayOptions('view', $view_options)
        ->setDisplayOptions('form', $form_options);
}

Now, why would I get the errors Notice: Undefined index: target_type in Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem::propertyDefinitions() (line 70 of core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php). and Drupal\Component\Plugin\Exception\PluginNotFoundException: The "" entity type does not exist. in Drupal\Core\Entity\EntityManager->getDefinition() (line 256 of core/lib/Drupal/Core/Entity/EntityManager.php).?

Anyone has a hint?
Thank you in advance!


texts: Any way to export webform node to other installation?

texts:
Is there anyway to export a webform node to another installation in D7? I need to export a webform node with all its components and webform settings.

Updated: I already  tried with Webform Share, but I can't get the "email" setting exported, this settings are just ignored. I have a very complex emails setting that I'd like to export as well.


texts: Apply CSS and Javascript affect to images

texts:
Updated

I am trying to add CSS and Javascript hover affect to some images in drupal 7 .. something like in this tutorial.

http://callmenick.com/2014/03/06/image-overlay-hover-effects-with-css3-t ...
Hover on some touch devices is sticky like iphone .. in this example it gives the user a (X) which close the sticky hover when it is touched

i have jQuery Update already installed ... and when i applied the code like in this tutorial in custom CSS and Javascript files .. its not working ... i really do not know what am i doing wrong or if i have to install another library to drupal or what am i missing to add to drupal ... even when i try to test it here http://codepen.io/anon/pen/onsyH ... still not working ..

any help will be appreciated


texts: How to get the referenced entity name instead of target_id in Normalizers?

texts:
I am working on exposing the article type content via REST in JSON format. I am using Normalizers to generate the required data format.

Normalizer:

use Drupal\serialization\Normalizer\ContentEntityNormalizer;

/**
 * StdClass normalizer.
 */
class NewsFeedNormalizer extends ContentEntityNormalizer {

  /**
   * @inheritDoc
   */
  public function normalize($entity, $format = NULL, array $context = []) {
    $node_detail = parent::normalize($entity, $format, $context);
    // $news_data = [];
    $news_data['id'] = $node_detail['nid'][0]['value'];
    $news_data['type'] = $node_detail['field_story_type'][0]['target_id'];
    $news_data['title'] = $node_detail['title'][0]['value'];
    $news_data['summary'] = $node_detail['body'][0]['summary'];

    return $news_data;
  }

}

Tha above code will return target_id in $news_data['type']. But I need to pass label of the term which is referred. I tried with another Normalizer called EntityReferenceFieldItemNormalizer But there also i didn't get the required result.  Can anyone help me in this regard? Any suggestions will be apprceiated.


texts:
I got this d7 sidebar code from a theme and I am trying to make it work for d6..  Can someone help

Info file contains:
regions[sidebar_a] = 'Sidebar A'
regions[sidebar_b] = 'Sidebar B'

This is the code:

                  <?php
                      if(isset($variables) && isset($variables['sidebars'])):

                        if(isset($variables['sidebars']['left'])):
                          foreach($variables['sidebars']['left'] as $value):
                            if (!empty($page['sidebar_'.$value])): ?>
                            <div id="sidebar-<?php echo $value; ?>" class="col-<?php echo $value; ?> sidebar left tb-height-balance tb-region tb-scope tb-sidebar tb-left">
                              <?php print render($page['sidebar_'.$value]); ?>

                        <?php endif; endforeach; endif; ?>

                      <?php
                        if(isset($variables['sidebars']['right'])):
                          foreach($variables['sidebars']['right'] as $value):
                            if (!empty($page['sidebar_'.$value])): ?>
                            <div id="sidebar-<?php echo $value; ?>" class="col-<?php echo $value; ?> sidebar right tb-height-balance tb-region tb-scope tb-sidebar tb-right">
                              <?php print render($page['sidebar_'.$value]); ?>

                        <?php endif; endforeach; endif; ?>

                      <?php
                        if(isset($variables['sidebars']['hidden'])):
                          foreach($variables['sidebars']['hidden'] as $value):
                            if (!empty($page['sidebar_'.$value])): ?>
                            <div id="sidebar-<?php echo $value; ?>" class="col-<?php echo $value; ?> sidebar right tb-height-balance tb-region tb-scope tb-sidebar tb-right tb-hidden">
                              <?php print render($page['sidebar_'.$value]); ?>

                    <?php endif; endforeach; endif; endif; ?>


texts: Don't display block title on some content types

texts:
I try not to display the title block for one single content type. I do it in the settings of the title block under Visbility -> Content type there I tick the content type which should not have the title block rendered and I check the options Negate the condition.

Basically this works but for example pages generated from the Views module also get no title block rendered then.

Does anybody know about this (in my opinion) "misbehavior" of the block system and how to work around it?

Maybe it's also a problem of the views module... I guess everything which has a content type gets the title except the excluded content type but Views pages do not have a content type and therefor get excluded too.


texts: use drupal's hashing in an external php fil

texts:
we are making a few web services for a Drupal 7 based websites.
in that webservice, one task is to sign up new users on that website.

the only main issue at the moment for this task is to access the drupal hash function in a php code file that is not inside the drupal's installation directory.

any guidance on how to achieve this will be highly appreciated.


texts: How to join 2 views block with a views page

texts:
Created a content type x. Fields: title, body, serviceareas.
Added 5 nodes.

View1

Created a views page:

Views path: house/%.
Contextual Filter: added nid.
Selected body field to display.

View2

Created a views block:

Added nid. Excluded from display.
Added Title field. Output field as a link > link path: house/[nid]

Results:
When I click a title from the block, I get views page accordingly.

Addition:

View3
I would like to add one more views block which will select serviceareas field for that node.
This block will only display in all the views page.

When I click the title link (step 5), I like to display the body field(it works now already). I also like to display serviceareas field (step 7) to views 1 and views 2.
I am not sure how to join the views 3 to views 1 and views 2? So that I can see serviceareas related to the views page I am on.

Example:

Node/1
Title: title1
Body:  body1
Serviceareas: serviceareas1.

Node/2
Title: title2
Body:  body2
Serviceareas: serviceareas2.

When I click the title 1(views 2), views page(views1) should display body1(works) and on the same page another region, views block(views 3) should display serviceareas1.

When I click the title 2(views 2), views page(views1) should display body2(works) and on the same page another region, views block(views 3) should display serviceareas2.

      ------------------------<<<

I placed views2 and views3 block in the same region. Views 2 should display all the nodes titles(works). Views3 should display only field from the nid(does not work).

Views3 block: I added one field. Contextual filter: I added nid.

When I click a title link from views2, I get body from views1 page but I do not get the field from views3 block. Below is the view3 block -contextual section.


texts:
Working on my theme
I need to override a core Js file ..\core\modules\contextual\js\contextual.js
My code from theme.info
libraries-override:
  contextual/drupal.contextual-links:
    js:
      js/contextual.js: js/override/contextual.js

The problem is that the loading order of this component js files did change after the override which cause script errors :

So how can override file js core and still same order file?


texts: The taxonomy term field token doesn't show in Views

texts:
I am trying to call my taxonomy field token in the Views header.

I added the relationship "Content: Taxonomy terms on node," and then added the taxonomy term in the fields;
I went to the header settings and added the global text area, inside of which I checked "Replace with tokens";
I added my token.

This is my view and I am pretty sure this is a bug or I am doing something completely wrong.


texts:
Is it possible to add PHP code to a node? I have enabled the Context and Context PHP modules.

May anyone please tell me how I can do?


texts: Why is my functional test not matching my manual testing?

texts:
I have a Drupal 8 module for banning users based on country.

In it, I have the following test.

public function setUp() {
  parent::setUp();
  $this->drupalLogin($this->adminSitesUser);
}
public function testCompleteBan() {
    // node/1.
    $this->addBanNode("Read only page");
    // node/2.
    $this->addBanNode("Complete ban page");
    $this->drupalGet(IP_BAN_ADMIN_FORM_PATH);
    $edit = array(
      // Set the United States to Read Only
      // 0 = no action / 1 = Read Only / 2 = Complete Ban.
      'ip_ban_US' => 2,
      // Set the test IP address to a known Google US address.
      'ip_ban_test_ip' => '66.249.84.22',
      // Configure the paths for read-only and complete ban.
      'ip_ban_readonly_path' => '/node/1',
      'ip_ban_completeban_path' => '/node/2',
    );
    $this->drupalPostForm(IP_BAN_ADMIN_FORM_PATH, $edit, t('Save configuration'));
    $this->assertOptionSelected('edit-ip-ban-us', 2, 'Complete ban set correctly in country list table.');
    // Should be redirected to complete ban page after logout.
    $this->drupalGet('user/logout');
    $this->assertUrl('node/2');
  }

However, I get an error on the last line (assertURL()):
"Expected 'http://d8.dev/node/2' matches current URL (http://d8.dev/). Value 'http://d8.dev/' is equal to value 'http://d8.dev/node/2'."

It seems as if the page is not redirected on logout the way it is when manually testing with an extremely minimal installation and using the exact same settings (including permissions)/workflow as the tests.

Note all the form-based tests are working as well.

Any idea why this is not working in D8? (It works fine in D7.)


texts:
I want the german date format in my install profile.

I tried in my setup script:

drush en l10n_update -y
drush vset site_default_country de
drush language-add de
drush language-default de
drush vset date_format_short "d.m.Y"

but it is not sufficient. It would not show up in the UI->configuration.regionalsettings as custom date format

manually I have to create a custom date format ("d.m.Y") first and then I can set is as wanted "date type",

I would do it via drush php-eval or better in profile-install function

update: clarified a bit

update2 meanhile I discovered hook_date_format_types :-)  trying...


texts: I want to create a view with filters filters

texts:
I want to create a view with Better Exposed filters, filters exactly like in
http://www.shopmgd.com/gold-jewellery.html. I am new to drupal, so somebody please help How can i do dis? I am using drupal 7.


texts: Take User Back to Group When They Subscribe

texts: When a user clicks on "Subscribe" on a Organic Group they are taken to their profile, not kept within the group they just subscribed. How can I change this so they are kept within the group page?


texts: How to get a field value of multiple nodes?

texts: I have some node ids from entityfieldquery. I would like to get the values of a field from all of these nodes. Should I use db_query, or should do a node_load_multiple, and get the field value with a foreach? db_query seems more efficient.


texts: How can I add a second submission handler to a form to run after the default handler node_form_submit

texts:
I need to generate a node of a dependent content type when creating a node of the primary content type.

I have successfully created the function to be called and attached it to the form and it creates the node as desired, but since the function that generates the secondary node runs first, it cannot be populated with the node id of the primary node, nor with any other data elements from the primary node.

How do I ensure that the submit handlers are executed in the proper order?

   $form['#submit'][] = 'nttac_custom_tta_submit';
   $form['actions']['submit']['#submit'][] .= 'nttac_custom_tta_submit';
   $form['actions']['submit']['#submit'][] = array('node_form_submit','nttac_custom_tta_submit');

None of the above methods seem to work although they do get the handlers in the proper order


texts: How can get the current region inside the 'hook_preprocess_block'?

texts:
How can I get the current region name inside the hook_preprocess_block()?
I tried the following code, but it seems something is wrong.

function ThemeName_preprocess_block(&$variables) {
  if ($variables['elements']['#region'] == "nav") {
    $variables['attributes']['class'][] = 'SomeStyle';
  }
}


texts:
I have a custom tpl for bean block called: block--bean--image-footer-block.tpl.php, also I have custom tpl for both fields:

field--title-field--footer-block.tpl.php
field--field-block-footer-imagen--footer-block.tpl.php

I don't want to use the default <?php print render($content); ?>

But If I try to use

<?php print render ($content['field_block_footer_imagen']); ?>

or

<?php print render ($content['title_field']); ?>

I get this error

Fatal error: Only variables can be passed by reference in

The beans fields are:

title_field
field_block_footer_imagen

Any idea to print both fields?

Thanks

Oskar


texts: pm-update fails "sh: --backend=2: command not found"

texts:
The pm-download command is working so I can update modules individually, but I can't do it in bulk. Both drush 6.2.0 and 6.1.0 give an error.

The output of drush up --debug is the following.

  Bootstrap to phase 0. [0.01 sec, 2.24 MB]
  [bootstrap] Drush bootstrap phase : _drush_bootstrap_drush() [0.01
  sec, 2.37 MB] [bootstrap] Cache HIT cid:
  6.2.0-commandfiles-0-da12a99782b48770f5d9ad8965ca5448 [0.02 sec, 2.39 MB]           [debug] Bootstrap to phase 0. [0.09 sec, 6.4 MB]
  [bootstrap] Bootstrap to phase 6. [0.14 sec, 6.4 MB]
  [bootstrap] Drush bootstrap phase : _drush_bootstrap_drupal_root()
  [0.14 sec, 6.41 MB]                     [bootstrap] Initialized Drupal
  7.24 root directory at /path/to/site [0.16 sec, 7.43 MB]    [notice] Drush bootstrap phase : _drush_bootstrap_drupal_site() [0.16 sec, 7.44
  MB]                     [bootstrap] Initialized Drupal site default at
  sites/default [0.16 sec, 7.44 MB]
  [notice] Cache HIT cid:
  6.2.0-install_profile-66ecfeb9791a023150773849f1550c5d [0.16 sec, 7.45 MB]          [debug] Cache HIT cid:
  6.2.0-commandfiles-2-699657487b88e8b0c2ede2984aa12913 [0.16 sec, 7.45 MB]           [debug] Drush bootstrap phase :
  _drush_bootstrap_drupal_configuration() [0.17 sec, 7.47 MB]            [bootstrap] Drush bootstrap phase : _drush_bootstrap_drupal_database()
  [0.17 sec, 7.51 MB]                 [bootstrap] Successfully connected
  to the Drupal database. [0.17 sec, 7.51 MB]
  [bootstrap] Drush bootstrap phase : _drush_bootstrap_drupal_full()
  [0.18 sec, 8.14 MB]                     [bootstrap] Cache HIT cid:
  6.2.0-install_profile-66ecfeb9791a023150773849f1550c5d [0.37 sec, 26.15 MB]         [debug] Cache HIT cid: 6.2.0-commandfiles-5-8aee30ce3a469e89d0725cfb79ceb51b [0.37 sec, 26.16 MB]          [debug] Drush bootstrap phase :
  _drush_bootstrap_drupal_login() [0.38 sec, 26.62 MB]                   [bootstrap] Successfully logged into Drupal as Guest (uid=0) [0.38
  sec, 26.63 MB]                          [bootstrap] Found command:
  pm-update (commandfile=pm) [0.38 sec, 26.63 MB]
  [bootstrap] Calling hook drush_pm_update [0.71 sec, 26.97 MB]
  [debug] Loading release_info engine. [0.9 sec, 29.07 MB]
  [notice] Loading version_control engine. [0.9 sec, 29.17 MB]
  [notice] Loading package_handler engine. [0.91 sec, 29.19 MB]
  [notice] Executing: wget --version Including
  /usr/local/Cellar/drush/6.2.0/libexec/commands/pm/updatecode.pm.inc
  [0.93 sec, 29.21 [bootstrap] MB] Calling hook
  drush_pm_updatecode_validate [0.94 sec, 29.31 MB]
  [debug] Returned from hook drush_pm_updatecode_validate [0.94 sec,
  29.31 MB]                               [debug] Calling hook drush_pm_updatecode [0.94 sec, 29.32 MB]
  [debug] Cache HIT cid:
  6.2.0-alias-path--2c8463220c4fed24dfb54242bc0f682e [0.94 sec, 29.36 MB]             [debug] Backend invoke:   --backend=2 --verbose
  --debug --root=/path/to/site          [command]
  --uri=site.local  pm-updatestatus 2>&1 [1.26 sec, 29.37 MB]   --backend=2 --verbose --debug --root=/path/to/site --uri=site.local            [notice] pm-updatestatus 2>&1 [1.26 sec, 29.38 MB] Illegal string
  offset 'site' backend.inc:1013 [1.27 sec, 29.38 MB]
  [warning] The command could not be executed successfully (returned:
  sh: --backend=2: command not found   [error] , code: 127) [1.27 sec,
  29.38 MB] Returned from hook drush_pm_updatecode [1.27 sec, 29.36 MB]                                        [debug] Changes made in drush_pm_updatecode have been rolled back.
  [1.27 sec, 29.37 MB]                 [rollback] Command dispatch
  complete [1.27 sec, 29.34 MB]
  [notice] Returned from hook drush_pm_update [1.28 sec, 27.27 MB]
  [debug] Command dispatch complete [1.28 sec, 27.24 MB]
  [notice]  Timer  Cum (sec)  Count  Avg (msec)   page   1.113      1
  1113.33 Peak memory usage was 31.64 MB [1.28 sec, 27.24 MB]                                               [memory]

The issue happens under OS X Mountain Lion and PHP 5.4.20, and continued after upgrading to Mavericks.


texts: How do I set the default value of a datetime form element?

texts:
I have a requirement of developing a custom contact form in drupal 8. I am able add all the fields but coming to date time field unable to set the default value to current date.

This is my date field code

$form['start_date'] = [
  '#type' => 'datetime',
  '#title' => t('Start Date'),
  '#description' => date($date_format, time()),
  '#default_value' => time(),
];


texts: Migrated content type fields not showing

texts:
I'm trying to migrate custom content types with attached fields from Drupal 7 to Drupal 8. Using drush migrate commands I can successfully migrate all content types, but I have problem with fields.

First I run upgrade_d7_field migration, than upgrade_d7_field_instance and last migration is upgrade_d7_node_MY_CONTENT_TYPE_NAME_content.

If I go to Structure -> Content types and then open my custom content type (by pressing Manage fields) I can see all fields attached to it - everything is ok. If I choose Content from main menu and try to create new content for my content type I only see Title field, no more fields are displayed. Same are with migrated content - if I 'm trying to edit it, I see only title.

What I'm missing ? I have migrated data in Drupal 8 fields table - node_field_MY_FIELD_NAME. I am logged in as admin user, so I should have all permissions to view this fields.


texts:
I need to add files to multiple value file field using drupal rest api (restws module).
return format of restws is something like this :

"field_files": [

    {
        "file": {
            "uri": "http://drupal/file/445",
            "id": "445",
            "resource": "file"
        }
    }
],

but when I send it to http//drupal/node/<node_id> restws returns not acceptable.

Can anyone suggest which format I must use to send data to?

and second question : How can I upload files using restws module ?


texts: How do I fetch the password from the database?

texts:
Suppose I entered ABC as password; its hash is like $S$DNcgO9.CUWosQrms0/CqWvLIUFikmoczZ42n9bL6wxiH1OhIQbd5, which is stored in the user table.  I need to retrieve the plain password.

How can I achieve this?


texts: Why is the Commerce product's price hidden in my view for Anonymous User?

texts:
I have a very strange problem with the Views and Drupal Commerce. I would like a list of products and their prices, but in the view - and ONLY in the view, the price is hidden for anonymous users. I can see it when I am logged in, and if I go to the actual product page it is showing for all users, just not on the view!  STRANGE!  I've made sure that anonymous users can access the checkout, which they can.

I'm using

Drupal 7.54
Drupal Commerce 7x 1.13
Views 7x 3.14

The view is pulling in the price through fields

Content: Product
formatter: Rendered Product
View Mode: Content: Teaser (also tried Commerce Product: Content: Teaser)

If I add a relationship it looks fine when logged in but the whole view completely disappears when not logged in.

I've never run into this issue with views before and I've done quite a few e-commerce sites.  I assume that this is a permission problem somewhere, but I can't seem to find it and I'm feeling completely stupid for not being able to trouble shoot this.  Can anyone give me any hints?


texts: Extracting UID information from a URL and sending email to this user

texts:
As a beginner, I would be grateful if this community could help me out to solve the following problem, by giving me some pointers.
This is the scenario I would like to implement in Drupal (I guess I need to create my own module):

A user (“U1”) enters a URL which looks like this:
www.mywebsite/Foo/UID2
Note that U1 does not need to be registered on my web site ( = anonymous), although he / she may be, to access the page which will be invoked through this URL.

U1 is then automatically redirected to a web form page where he / she will enter text: “Hello my name is Bob…”, an email address: “u1@example.com, a phone number “123 345 67 89”.

An email containing this information will be sent to the user that has UID2 as his / her user ID. U1 will not see U2’s email address.

The information that U1 sent an email to U2 will be kept in a “from-to” table which manages the following information:

UID_from (if it exists)
U_from First Name
U_from Last name
Text_from
Email_from
Telephone_from
UID_to (note: this UDI always belongs to a registered user)
Date & time

Can someone give me some indications of the various functions invoked? If a ready-made module exists (which I did not find), the better.

I suspect hook_menu will be used; but how to extract UI2 from the URL and send it to a web form, which later is handled by an email module?

Thanks so much,

Peter


texts: Search api autocomplete - how to show search form?

texts:
I use Search Api with Search api autocomplete module.

I made configuration of autocomplete module on Search Api page, but I do not see block for input.

Should I config anything else for it?