texts: how easy it is to get the date when the order is completed?

texts:
I need to get the due date (payment) of the last order, but I got some kind of crooked code.
I receive all user orders by request.
      $allOrders = \Drupal::entityTypeManager()->getStorage('commerce_order')->loadByProperties(
    ['state' => 'completed',
      'uid' => $uid,
    ]);

I cannot figure out why the following code is not working
$allOrders[111]->values["completed"]["x-default"]

The following code worked for me, I think it is wrong and unnecessary.
      $IndexAr = array_key_last($allOrders);
  $oneIndex = $allOrders[$IndexAr];
  $AllValues = $oneIndex->toArray();
  $DataTime = $AllValues["completed"][0]["value"];

Here is the data structure:


texts:
After I install the devel module I can no longer configure any blocks, I get an internal server error. I uninstalled and the issue stopped, re installed and its an issue again.

Furthermore, I cannot see the grey box in the lower left hand side of the browser where I can access all the variables available in a given page. This is the main reason for attempting to use the module. The module is successful in printing all SQL queries at the bottom of the page however. Any insight as to what might be wrong?

Update: I can also no longer uninstall the devel module from within the drupal backend, i receive the same error when trying to access the uninstall page, I will have to remove it manually from the file system

Update: Removed the devel module once again and problem is gone...


texts: Filter unpublished nodes, even for Admin

texts: How can I filter out unpublished nodes in a view even if the user viewing it is an administrator?


texts: `drush pm-update drupal` fails to copy to backup

texts:
Tried to update some of my Drupal 7 installation with drush. Some of them were successful while some were not. The error ones generate message like this:

[foobar@server htdocs]$ drush pm-update drupal -y
Update information last refreshed: Thu, 02/09/2017 - 15:52
 Name    Installed Version  Proposed version  Message
 Drupal  7.53               7.54              Updates Available

Code updates will be made to drupal core.
WARNING:  Updating core will discard any modifications made to Drupal core files, most noteworthy among these are .htaccess and robots.txt.  If you have made any modifications to these files, please back them up before updating so that you can re-create your modifications in the updated version of the file.
Note: Updating core can potentially break your site. It is NOT recommended to update production sites without prior testing.

Do you really want to continue? (y/n): y
Unable to copy /home/foobar/htdocs/drupal-7.54 to                                                          [error]
/home/foobar/drush-backups/foobar/20170209084742/drupal.
Unable to move /home/foobar/htdocs/drupal-7.54 to                                                          [error]
/home/foobar/drush-backups/foobar/20170209084742/drupal.
Failed to backup project directory /home/foobar/htdocs/drupal-7.54 to                                      [error]
/home/foobar/drush-backups/foobar/20170209084742/drupal

I've checked the folder "/home/foobar/drush-backups/foobar/20170209084742/drupal". It actually exists with a full copy of the htdocs folder contents. I have no idea what to expect otherwise.

I applied --debug flag and the output looks like this:

http://pastebin.com/raw/0XgDtre0

Any suggestion how to fix this problem?


texts: How to copy current directory into Drupal profile folder via drush?

texts:
I've this yml file in my current folder:

$ cat profile.yml
api: 2
core: 7.x
projects:
  drupal7:
    type: "copy"
    download:
      url: "file://."

and 3 empty files (just for now): drupal7.info, drupal7.install, drupal7.profile.

And I've downloaded fresh Drupal:

$ drush -y dl drupal
Project drupal (7.39) downloaded to drupal-7.39.

Now I'm trying to copy my profile into Drupal directory via:

$ drush make --no-core profile.yml drupal-7.39/
Beginning to build profile.yml.
Non-existent project type copy on project drupal7.

and the same with:

$ drush make -r drupal-7.39/ --yes --no-core profile.yml

This is based on this example:

projects[example][type] = "profile"
projects[example][download][type] = "copy"
projects[example][download][url] = "file://./example"

but I'd like to achieve that in yml format.

What is the correct syntax then? Or how does it work?


texts: How to make search on all fields (title and tags as well as body)?

texts:
The built in search engine in Drupal 7 doesn't search on the title or tags fields, just on the body of the node. I need to be able to search on all fields.

What is the best module to install for this if I'm running Drupal on Apache on Windows?


texts: How do I detect whether any contact forms have been created?

texts:
Context: On my Drupal 8 site I'm trying to add in a new section containing a view that lists out all forms. The user can then click on one of the form and it launches a download of all the messages sent through that form. However that section should only be visible if the user has created at least 1 form.
What I've tried: So far what I've discovered is that the contact forms are stored in the config table in the database, so I could theoretically run a query like "SELECT 1 FROM config WHERE name LIKE '%contact.form%'" or whatever the equivalent in D8 is. However, it seems like there has to be a quicker way to return either the presence of contact forms or the contact forms themselves programmatically.
Final question: How can I return either the contact forms themselves or at least a boolean representing the presence of contact forms programmatically?


texts: voting in all fields before submit results

texts:
I have a content type (computer) with multiple rate fields (performance, battery range, price, ...) type fivestars. By default, the module sends the results by ajax whenever you click on a star; what I need is that you vote in all fields, before the results are sent (with a button).

Is it possible to do this? And how?


texts: Adding a views block to a menu? Or adding a menu to a views block?

texts:
I need to create a dropdown menu which consists of the menu items and also a views block of recent nodes. Yes this is technically a megamenu, but how would one build it without a megamenu using only menus and views only?

How do you make a views show up inside a menu? I'd imagine you would need an extra module for it.
But if you built a views block and did an entity menu call into the views header, that would work too right?
Or maybe I'm going about the long way of doing it and should just use a megamenu module, which one would be best?

Of those 3 options which would work best with the least amount of work involved?


texts: How know what theme/theme name a Drupal site is using?

texts:
Like in Wordpress, we can know what theme name a site is using by look at the page source and it will show something like

wp-content/theme/theme-name

Well, how we can know what theme a Drupal site is using? I try to look at the page source of a Drupal site but i cannot figure out what theme or theme name the site is using.

Is there any trick to unlock this?


texts: First time when page load flexslider not Initialize

texts:
I am facing Issue can any body help me .
 Flexslider is working fine on dev/test/live server but on production server for the first time flexslider is not Initialize . I
have checked all structure is ready just that flexslider not
initialising. Javascript & CSS coming from CDN and we have used
 rocketscript to compress js .


texts: Rendering views block values in a custom form field

texts:
I want a select list in a custom form drop down field which should list down all node titles specific to a content type. For this, I have created a view block, restricted it to one content type, allowing only node titles in its fields, and I am rendering this in the custom form. Below is the code I am using to do this:

In custom module:

$customblock = \Drupal::service('plugin.manager.block')->createInstance('community_list', []);
$variables['content']['community_select_list'] = $customblock->build();

$form['community'] = array(
  '#type' => 'select',
  '#title' => $this->t('Community name'),
  '#options' => array(
    $variables['content']['community_select_list'],
  ),
);

Many thanks in advance!


texts: Easy way to make an Installation Profile

texts: I want to use my current website as an installation profile. I've set it up so it contains some useful content types, views and example content nodes. Is there a no-coding way to create an installation profile that would look exactly as my current site when installed?


texts:
Hello i dont seem to be able to change the colour of my links hover on my main content table. Ive tried everything but it seems to want to stay white. Can anyone identify the CSS i should be changing?

thanks

main left table here-
enter link description here


texts: Embedding an entity refenrence add button on a q=node/view page

texts:
I am creating a 'Activity Management' site for that I have created Activity and Participant content types.

Participant content type has Full Name, Cell No, Email, Address fields and 'Activity' has title, location, time and activity participant - entity reference field of Participant content type.

I have created 'activity managers' role who can add/delete participant of an activity. I want to add two buttons on activity q=node/(view/display) page from where 'activity managers' can

Add new participant
Add from existing participant, to the activity.

I have played around inline entity form, entity form but without luck. Inline entity form does it but on node/(add/edit) page not from q=node/view.


texts:
I am creating Job portal and in that job portal When I create a Job post using admin and save that job as draft instead of posting it to all and for that draft one link is get created and I want to make that job draft link to be accessible to all users including guest.

following is the code for creating draft :

case 'draft':
        $new_node = node_load($job_node_nid,null,true);
        $new_node->status = 0;
        node_save($new_node);
        $_SESSION['bf_job_creation'] = array('step'=>1);
        header('Location: ' . url('my-account'));
        break;

 This above code creates job draft but link to access that draft I just want to make that link to be accessible to all by writing code.

I have tried following code to make link accessible but not succeed :

case 'draft':
    $new_node = node_load($job_node_nid,null,true);
    $new_node->status = 0;
        $new_node->field_job_status = array(array('value'=>'published'));//added this
    node_save($new_node);
    $_SESSION['bf_job_creation'] = array('step'=>1);
    header('Location: ' . url('my-account'));

break;

how to make the link to job draft public??


texts: How to access $user_profile in page.tpl.php or $page in user-profile.tpl.php in Drupal 7?

texts:
I need to change layout of a profile depending on user's field. So, I need to either include regions in user-profile.tpl.php or access $user_profile to test that field in page.tpl.php.

I've seen this done, but can't find it now.


texts:
I am working in Drupal 7.

I have a text-area in profile. I need the text area has a specific text format without editor but allows tags HTML.

The text format only is for the role "registered users", not for other roles and only in the text-area in the profile. This restriction is only for the field in profile.

If I have a role named "role test" that can edit articles and edit the profile, I need that the "role test" has not html tags in the text-area field in profile but the "role test" has editor in the content articles.

Thanks.


texts: Possible explanation for error and site crashing randomly without any provocation?

texts:
I have a multilingual client that "suddenly and randomly" started suffering errors and a site crash.

The client assured us they "have not touched the site since it went live." And, more or less we can confirm that given that we have not updated the site on their behalf, as we are the the only ones with update privilages.

Has anyone had their multilingual site "just randomly crash" after months of being live with no problem?

This is the error message. Has anyone seen this before?

  WD php: PDOException: SQLSTATE[42S22]: Column not found:
  1054 Unknown column 'ml.language' in 'where clause':

  SELECT ml.*, m.*, ml.weight AS link_weight FROM {menu_links} ml
LEFT OUTER JOIN {menu_router} m ON m.path = ml.router_path
WHERE  (ml.menu_name IN (:db_condition_placeholder_0, :db_condition_placeholder_1, :db_condition_placeholder_2, :db_condition_placeholder_3,:db_condition_placeholder_4)) AND (ml.link_path IN (:db_condition_placeholder_5)) AND (ml.language IN (:db_condition_placeholder_6, :db_condition_placeholder_7));
Array (
  [:db_condition_placeholder_0] => 1cf698d64d1aa4b83907cf6ed55db3a7f8e92c91
  [:db_condition_placeholder_1] => navigation
  [:db_condition_placeholder_2] => management
  [:db_condition_placeholder_3] => user-menu
  [:db_condition_placeholder_4] => main-menu
  [:db_condition_placeholder_5] => node
  [:db_condition_placeholder_6] => und
  [:db_condition_placeholder_7] => ja
)

  in i18n_menu_init() (line 829 of sites/all/modules/i18n/i18n_menu/i18n_menu.module).


texts: How do I migrate the "Created" and "Modified" date fields?

texts:
I created a migration script to test this out.

This is the code I used.

id: article_csv_import
class: null
field_plugin_method: null
cck_plugin_method: null
migration_tags: null
migration_group: Import articles
label: 'Import articles'
source:
  plugin: csv
  path: 'modules/custom/sigtarp_migrate/data/articles.csv'
  header_row_count: 1
  ids:
    - id
process:
  nid: id
  title: title
  body/format:
    plugin: default_value
    default_value: full_html
  body/value: body
  changed:
    plugin: callback
    source: update
    callable: strtotime
    created: date
  created:
    plugin: callback
    source: update
    callable: strtotime
    created: DateCreated
  status: Status
  type:
    plugin: default_value
    default_value: article
destination:
  plugin: 'entity:node'
migration_dependencies:
  required: {  }

When I run the migration script, this is what happen when both the Changed and Created fields are entered.

This is the content of the CSV file used for the migration.

Why is the date off? How can I fix it?


texts:
I have 2 content types:

vehicles
engines

Several engine nodes are referenced to the single vehicle.
Is there any way I can load all engines referenced to the single vehicle node if I have that vehicle node object (thus the nid as well)?

I use Node reference module.

If you need any more info, please ask.
Thanks in advance!


texts: Disable 3rdparty hook from custom module once

texts:
Im using the menu_trail_by_path which does a pretty good job for most of my URL's, however in a custom module I'm setting the breadcrumbs directly (drupal_set_breadcrumb in a page callback). These crumbs get messed up due the menu_trail_by_path module (sort of overwritten I guess =/)

This happens because menu_trail_by_path sets the crumbs using hook_page_delivery_callback_alter which is called after the page callback apparently.

I would like to keep my custom crumbs in the page callback as it has all the required (dynamic) data available.

Hero we go.. how on earth can I disable the page_delivery_callback_alter hook from the menu_trail_by_path module... once? I.e. for the current runtime /request only.

Thanks!

Roland Franssen


texts:
Possible Duplicate:
  How do I limit the number of Views results on specific pages?

I have a view that I use for showing different items on my website. It is a very simple view that accept taxonomy term as argument and shows the related nodes.

This view also have a pager, that handle 20 items per page.

I want to see if it is possible to dynamically change that to another number, for example if we are in different category (taxonomy term), I want to show different items per page.

I have tried achieving this by hook_views_pre_build or hook_views_pre_execute but no chances yet!

I am using Drupal 7 and Views 3.

Anyone can help please?


texts: Adding url dynamically in jwplayer javascript using drupal 7

texts:
I am using file_create_url function in my custom menu for particular node video field. i want to load this url in jquery jwvideo player file path dynamically under below this code

jQuery(document).ready(function() {
  jQuery(".field-item.even img").click(function()
   {
     var basepath = Drupal.settings.basePath;
     alert(basepath);

     var playerInstance = jwplayer("myElement");
     playerInstance.setup({
      image: "http://localhost/drupal742/sites/default/files/mypics/index1.jpeg",
      file: "http://localhost/drupal742/sites/default/files/mypics/ameex.mp4",
      title: "My Cool Trailer",
        height: 300,
        weight: 300,
        //flashplayer: 'player.swf',
        primary: 'html5',
       events: {
         onReady: function(){alert('im ready')},
         onPlay: function(){alert('lets play')}
         }
 });
});
});


texts: Returning BinaryFileResponse to Custom Block

texts:
Alright, so I have a custom block that is implements a build() method. I also have a controller which loads in terms and should they pass certain requirements, it will return a binary file response, displaying an SVG file. I want my custom block to call this controller method and display the rendered BinaryFileResponse, but I'm not quite sure how to do this.

My block code is as follows

class MapplicBlock extends BlockBase {

/**
* {@inheritdoc}
*/
public function build() {
  $svgFile = new MapplicSvgController;
  $mapSvg = $svgFile->_mapplic_svg();

  return [
    '#markup' => $mapSvg,
    '#attached' => array(
      'library' => array(
        'mapplic/mapplic',
       ),
     ),
   ];
  }
}

where my controller is MapplicScgController and _mapplic_svg() is the svg serving method in the controller.

The function _mapplic_svg() ends up handing back

return new BinaryFileResponse($uri, 200, $headers);

It works just fine. Output is the SVG image in browser, but in my block it comes out as:

HTTP/1.0 200 OK 0: Content-Type Cache-Control: public Date: Fri, 13 Jul 2018 17:01:11 GMT Last-Modified: Wed, 11 Jul 2018 19:08:26 GMT 1: text/csv; utf-8"

How do I get the block to display the rendered SVG instead of this meat-data related to it?

Picture of _mapplic_svg() output.


texts: how to pass multiple view fields to an action via vbo in D7?

texts:
I have a view relating different types of information together.
I have a node type and 2 relation types. The base node is related to other nodes using the 2 relations.

Lets say there are 3 fields in the view listing: the base node and 2 other nodes related to the base node:

nid of the "base node"
nid of a related node (using relation1)
nid of another related node (using relation2)

I like to do some action with the base node using views bulk operations.
In this custom action I like to use the nids of the other 2 nodes.

My problem is, you can only use one of the three nodes in the action, depending on what you selected in the bulk operations field.

Is there a way to pass ALL three nids?

I know I can use views php to create a hidden field, containing the other two nids and then use the hook_form_submit to hook into the submitted form.

But is there a more elegant way, only to use the custom action, without hooking the submitted views form?


texts: How to get Final SQL query when using Views?

texts:
How do I get complete SQL query from Views, the one I could run in mysql directly.For example biggest stumbling block is fields part. Like below

SELECT users_node.uid AS users_node_uid, node.created AS node_created, node.nid AS nid, users_node.mail AS users_node_mail, 'user' AS field_data_field_first_name_user_entity_type, 'user' AS field_data_field_last_name_user_entity_type, 'node' AS field_data_field_purchase_date_node_entity_type, 'node' AS field_data_field_serial_number_node_entity_type
FROM
{node} node
LEFT JOIN {users} users_node ON node.uid = users_node.uid
WHERE (( (node.status = '1') AND (node.type IN  ('product_registration')) ))
ORDER BY node_created DESC
LIMIT 50 OFFSET 0

this lines are problematic
field_data_field_first_name_user_entity_type,
field_data_field_last_name_user_entity_type
etc

They are not real fields in DB, they somehow get rewritten somewhere, but I can't find where and how. How to get the FINAL query to DB in drupal when using views?

p.s.
in image, you can see what I get for those fields in phpmyadmin if I run query. Not really useful.


texts: View field with link to excecute action plugin

texts:
How can one add a field in views with a link to a custom Action plugin?

With bulk operations it's possible to create a checkbox to perform an action to a set of results. My actions have an access check that may be different per result so using the checkbox would result in a lot of warnings when the user tries to perform the action and doesn't have access.

I'd prefer to show the action as a link and only show the link when the user has access.


texts: how to add username and password field in commerce order

texts:
I am new with Drupal and I am willing to learn more.

now, I am creating a project and I am using the drupal commerce.

In the check-out process, In default, for unregistered users, it has the email field and others field. I just want to add username, password and password confirm fields so that the anonymous user will register then he can pay for the item he cheked-out.

but the problem is I don't know how to add those fields.

I have also checked the Checkout Rules (Create a new account for an anonymous order), I think the process of creating the user is done here, but I don't know how.

Does anyone can help me in my case?
any help will be appreciated...

thanks in advance ...


texts: Add only one input filter to a textarea using form api

texts:
I have created a custom form, in which I have one textarea field with a wysiwyg.
Here is the code

$form['text'] = array(
    '#type' => 'text_format',
    '#default_value' => variable_get('text'),
    '#title' => t('text'),
    '#format' => NULL,
  );
  return system_settings_form($form);

So it returns me a textarea field with a format dropdown. Which I don't required. I need only to use the filtered_html and the format dropdown should not appear.


texts: Custom blocks created as a plugin in a module not showing for Block::load()

texts:
I have a couple of blocks that have been created using the ... extends BlockBase syntax in my module. They work perfectly fine, and I can add them on the blocks layout page, can add them into DS as a field, etc. They definitely exist fine.

However, when I try and render them using Block::load(), they won't show up, unlike other blocks that work fine.

For example, if I have the following docblock:

/**
 * Provides a 'Cute Cats' Block.
 *
 * @Block(
 *   id = "cute_cats",
 *   admin_label = @Translation("Cute cats yo"),
 * )
 */
 class CuteCats extends BlockBase { ... }

... and then try and call it like this:

$block = \Drupal\block\Entity\Block::load('cute_cats');
return render(\Drupal::entityTypeManager()
  ->getViewBuilder('block')
  ->view($block));

Any idea why? Thanks in advance.


texts: Simplest way to get a full set of favicons and touch icons

texts:
So you've generated a big batch of favicons, touch icons, tiles and whatever to cover the full range of files a broswer might look for, and the generator you used has helpfully given you a whole lot of code to just drop into your HTML <head>, something like this:

<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link rel="apple-touch-icon" sizes="57x57" href="/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="/apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="/apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="/apple-touch-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="/apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="/apple-touch-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon-180x180.png">
<link rel="icon" type="image/png" href="/favicon-16x16.png" sizes="16x16">
<link rel="icon" type="image/png" href="/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="/android-chrome-192x192.png" sizes="192x192">
<meta name="msapplication-square70x70logo" content="/smalltile.png" />
<meta name="msapplication-square150x150logo" content="/mediumtile.png" />
<meta name="msapplication-wide310x150logo" content="/widetile.png" />
<meta name="msapplication-square310x310logo" content="/largetile.png" />

Great. Trouble is, that's not so simple in Drupal, where:

The root site directory is off limits due to updates.
Even after, say, find/replacing content="/ to content="/sites/all/themes/yourtheme/icons/, the standard way to add items to <head> is one line at a time, through a hook in your template.php or similar.

This is a routine task I do for every site. Is there are simpler way than turning every one of those into something like this from a related apple-touch-specific question in a template hook:

 $appleIcon = array(
    '#tag' => 'link',
    '#attributes' => array(
       'href' => '/sites/default/files/apple-touch-icon-144x144.png',
       'rel' => 'apple-touch-icon', 'type' => 'image/png'
     ),
  );
  drupal_add_html_head($appleIcon, 'apple-touch-icon');

Best  I can think of is overriding my html.tpl.php file, but I'd prefer not to override it if possible, in case Core or my base theme update it due to some new feature or best practice.

Everything  I can find online seems to be only interested in one favicon and one Apple icon, which isn't a problem.

There are custom modules for this, like Responsive Favicons, but they have issues reporting that some icons don't get picked up, and it seems an overcomplicated approach to simply adding some icons.


texts: Why doesn't a form immediately call its submission handler?

texts:
I have a form which is called from a page function. The page initially makes some external calls to get #default_value data which gets passed to drupal_get_form(). When the form is submitted, the page function gets called before the submission handler. Why is that? I don't get it and I don't want that to happen because it then connects to an external data API for no reason.

Does anyone know of a good place to find the calls order for a default submission handler? I'm unable to debug this.

There is an AJAX update when the form inputs refresh, but I don't see how that matters.


texts: Dynamic footer link based on current url

texts:
I've got a link to the mobile version of my site in the footer, but I need this link to be dynamic based off the page that the user is currently on.

Shown below are the options I have for the link.

Under the path there is this help text

The path for this menu link. This can be an internal Drupal path such as node/add or an external URL such as http://drupal.org. Enter <front> to link to the front page.

What I need is similar to the ability to use <front> to signify the homepage. I'd like to be able to use something like http://m.example.com/<node> so that this link will always go to the mobile version of the page that I'm currently on.

Is this possible? Or is what I want to do more complex than just using a keyword for the path?


texts: Warning: Illegal offset type in drupal_add_js() (line 4184 of C:\EasyPHP-5.3.8.1\www\lfp\includes\common.inc)

texts:
I am using D7. I am getting the above error when I created a js file with the code below and then included it in the .info file. What is wrong?

(function($) {
Drupal.behaviors.userLoginChanges = {
    attach: function(context) {
        $("#user-login-form").attr("placeholder", "Username");

    }
}
}) (jQuery);


texts: Partial start date with end date output views

texts:
I'm using views to output a list of nodes with dates. Some node dates have both a start and end date inserted.

If both a start and end date exists, i would like the date to be outputted only taking the day from the start date.

Current: 9 January 2018 - 10 January 2018

Desired: 9 - 10 January 2018

I've tried using a custom field and rewriting the results in views, but this doesn't work. I've also looked in the pre_render and preprocess functions and only see the start date.

Any ideas?


texts: In drupal 7, How to override theme_pager?

texts: I am using drupal 7 and zen theme. And am not able to override the theme_pager using zen_pager function in template.php. Any suggestion pls?


texts: Multipage form required field validation problem

texts:
I have a 9 page form (content type). In the first page I have a text field which is configured to be required. When this field is empty, and I hit the Next Step button to go the 2nd page of the form, I do not get any validation error. If I come back to the first page by clicking Previous Step button and then click the Next Step I get the required field validation error. I am wondering why I don't get the validation error when I click the Net Step button on the 1st form page where I have the text field that requires data.

Hope someone knows the answer to this problem.
Thanks.

Here is my custom module code:

  function ueb_package_build_request_helper_form_alter(&$form, &$form_state, $form_id) {
      if ($form_id == 'ueb_model_package_build_request_node_form') {
        $form['#validate'] = array('ueb_package_build_request_helper_form_validate');
        $form['#submit'] = array('ueb_package_build_request_helper_form_submit');
        $form['field_build_request_note']['und']['0']['value']['#attributes']['readonly'] = TRUE;

       // set the simulation start and end date
       $form['field_start_date']['und']['0']['#default_value']['value'] = '01/01/2011';
       $form['field_start_date']['und']['0']['#default_value']['value2'] = '12/31/2011';
      }
   }

    function ueb_package_build_request_helper_form_validate($form, $form_state) {
      $node_content_type = 'ueb_model_package_build_request';
      $step = $form_state['storage']['field_group_ajaxified_multipage_step'];
      //dpm($form_state);

     if($step == 1) {
       // validate the simulation start and end date
       // make sure this date is the calendar year 2011
       $start_date = $form_state['values']['field_start_date']['und'][0]['value'];
       $end_date = $form_state['values']['field_start_date']['und'][0]['value2'];
       $start_date_parts = date_parse($start_date);
       $end_date_parts = date_parse($end_date);
       if($start_date_parts['year'] !=2011) {
        form_set_error('Simulation start date', t('Start year must be 2011.'));
       }
     if($end_date_parts['year'] !=2011) {
       form_set_error('Simulation end date', t('End year must be 2011.'));
     }

  }

    function ueb_package_build_request_helper_form_submit($form, &$form_state) {
      drupal_set_message(t('Your request to build a package has been received.'), 'status');
   }


texts: How to theme the page template for search results

texts:
I want to change the page template when displaying search results. This seems straigh forward when dealing with a content type, but what is the content type for "search results".

E.g. I'll like to use something like page--search_results.tpl.php but I'm not sure of the correct name.

Note, I'm happy with the formatted output of the result items, so I assume I wouldn't be changing the templates under drupal/modules/search...

Thanks


texts: Using several different themes, I'm looking to add a generic region to the bottom of each "content" section of my webpage. The code I have so far is. . . . with Social Share being the name of the block.


texts:
I need to alter the element value of a taxonomy autocomplete field before it is processed and can't seem to find a way of doing so.

taxonomy autocomplete fields have an element validator attached, that replaces the String value with an array of terms:

[$form] (array)
  [field_myautocomplete] (array)
    [und] (array)
      [#element_validate] (array)
        [0] => "taxonomy_autocomplete_validate" (string)

I need to alter the String before the validator taxonomy_autocomplete_validate() // taxonomy.module:1747 passes it to drupal_explode_tags() // common.inc:7416. Thus I attach my own element validator via hook_form_alter():

[$form] (array)
  [field_myautocomplete] (array)
    [und] (array)
      [#element_validate] (array)
        [0] => "MYMODULE_validate" (string)
        [1] => "taxonomy_autocomplete_validate" (string)

My validator is executed first and uses form_set_value() to update the value (exactly what taxonomy.module:1782 does in its validator).

However, this only updates the value for $form_state and not $element which is the value used by taxonomy_autocomplete_validate(). Thus, the altered value is completely ignored and gets overwritten by the second validator, based on the original string.

Any suggestions beyond hacking core (make taxonomy_autocomplete_validate use $form_state) are most welcome.


texts: How to add the Interest field in profile page which links the user with similar interest?

texts: I have seen this type of field in drupal.org where some fields appeared as links which lists the users with similar interests or country. Don't know how to do that in Drupal7.


texts: Webform Module or hook_form_alter() - What is right for me?

texts:
I'm delving into my first custom Content Node Submission Form creation and looking at my first ever hook_form_alter() attempted efforts.
However, I'm confused over whether the WebForm module will do the job for me to allow user submission of new Node Content as I need to change the display of the said Node fields displayed. The way I read the WebForm documentation it's for emailed webforms and questionnaires, not really what I want but to submit new Node Content to the database, but others online say it can be used otherwise.

Would someone care to clarify before I waste another 2 hours effort?

Thanks in advance.


texts: How do I template preprocess our custom entity?

texts: I can preprocess node and page in a Drupal 8 template file, but I am not able to preprocess our custom entity. Is there anyway we can preprocess custom entities?


texts:
I'm creating a custom block and I'd like to add some Javascript to it.
I'm using a Render Array to add the Javascript to the page, which works fine, I'm then trying to add some variables to the Render Array for the Javascript to use.
This is what my Render Array looks like
$content = array(
  '#slides' => $slides,
  '#theme' => 'slider_block',
  '#attached' => array(
    'js' =>
      array(
        drupal_get_path('module', 'single_slider') . '/js/test.js' => array(
          'type' => 'file',
        ),
      )
  )
);

$content['#attached']['js'][] = array(
  'data' => array('word' => 'world'),
  'type' => 'setting'
);

return $content;

I'm then trying to access the variable in the Javascript (test.js) file using the following.
console.log(Drupal.settings);

At the moment this just returns with an empty object. If someone could point me in the right direction I'd appreciate it very much.
Thanks in advanced.


texts: Get Template Variables in my Custom Module

texts: I am new in drupal. I am trying to get a variable from a template file e.g. maintenance-page.tpl.php and want to get $title variable in a form e.g. admin/config/development/maintenance form. This form will contain a field/textbox to set a custom title and I want to print that custom title on maintenance-page.tpl.php page. How could it be implemented with custom module. I am using Drupal 7. Thanks in Advance.


texts: How to track popular categories (taxonomy terms)

texts:
On a website, we want to be able to produce a list the most popular categories (taxonomy terms). We don't want to rank terms by term page  views but rank terms by content page views. When a user views a node page, the score/rank of all terms associated with the node should increase.

I couldn't find any module that provides this feature. As most statistics modules count and aggregate pages views, an acceptable solution would be using a reliable page view counting module that stores its information in the database (or any query-able external datastore). From there, a periodic ranking of the terms' popularity could be computed.

The solution has to work behind a caching reverse-proxy and when Drupal caching is enabled.

Note: we are already using Google Analytics to track traffic.


texts: Is there an issue reporting module with these features?

texts:
We have 3 departments and we give IT support for all project users. We would like to receive there support request using our drupal 7 site  instead of receiving phone call.

We just need a support request form
The form sends a notification email to experts
The submitted issues should be listed by project group; only experts can access the list.
The form access privilege is only for authenticated users.
There is no progress status report for the users.

What do you suggest?


texts: How to use access callback and access arguments to restrict access by role?

texts:
I'm creating website for a hostel, in this there are two roles (guest and property owner).

if i give 'access callback' => TRUE the page can be accessed by both of the property owner and guest, but i don't need it, the page should be accessed by only property owners.


texts:
First off, let me say that I've tried the Drupal 6 answer shown in Using IN clause in db_query and it doesn't work.
I have a query that previously only needed to include items from a single taxonomy id:
$images = db_query("SELECT n.nid, n.title, f.filepath,
cti.field_iv_source_name_value AS source, bf.nid AS flagged
FROM node n
JOIN content_type_imagevault cti ON n.nid = cti.nid
JOIN content_field_att_file cfaf ON cfaf.nid = n.nid
JOIN files f ON cfaf.field_att_file_fid = f.fid
JOIN term_node tn ON tn.nid = n.nid
LEFT JOIN betterflag bf ON (n.nid = bf.nid AND bf.uid = %d)
WHERE n.type = 'imagevault' AND tn.tid = %d AND n.status = 1
ORDER BY n.created DESC LIMIT %d", $user->uid, 134, $displays_count);

The requirement has changed and we now need to pull images from multiple taxonomy ids. Based on the linked post above, I tried this:
$tax_ids = array(134, 139);
$placeholders = db_placeholders($tax_ids);
$images = db_query("SELECT n.nid, n.title, f.filepath,
cti.field_iv_source_name_value AS source, bf.nid AS flagged
FROM node n
JOIN content_type_imagevault cti ON n.nid = cti.nid
JOIN content_field_att_file cfaf ON cfaf.nid = n.nid
JOIN files f ON cfaf.field_att_file_fid = f.fid
JOIN term_node tn ON tn.nid = n.nid
LEFT JOIN betterflag bf ON (n.nid = bf.nid AND bf.uid = %d)
WHERE n.type = 'imagevault' AND tn.tid IN ($placeholders) AND n.status = 1
ORDER BY n.created DESC LIMIT %d", $user->uid, $tax_ids, $displays_count);

I just get a blank screen there. When I turn on Devel and display the query log, what it shows as running is:
SELECT n.nid, n.title, f.filepath, cti.field_iv_source_name_value AS source, bf.nid AS flagged
FROM node n
JOIN content_type_imagevault cti ON n.nid = cti.nid
JOIN content_field_att_file cfaf ON cfaf.nid = n.nid
JOIN files f ON cfaf.field_att_file_fid = f.fid
JOIN term_node tn ON tn.nid = n.nid
LEFT JOIN betterflag bf ON (n.nid = bf.nid AND bf.uid = 1)
WHERE n.type = 'imagevault' AND tn.tid IN (1,5) AND n.status = 1
ORDER BY n.created DESC LIMIT 0

I have no idea where the 1,5 is coming from in the rendered query. What do I need to do to make this work? Does it only work for nid when selecting directly from a node? If so, how can I use an array in the query? Do I skip the placeholder for that param and just put it directly in the WHERE clause?
Updated info
So it appears that completely aside from the strange case of 134, 139 being translated to 1,5, I also have another issue. Although the variable $displays_count is set further up the page to 5, it's still translating in the query to 0. (I've echoed the value out right before the query, and it's still 5 there, so I don't know what's happening or why changing the tn.tid placeholder would have any effect on the limit placeholder.)
$tax_ids = array(134, 139);
$params = $user->uid;
$params[] = $tax_ids;
$params[] = $displays_count;

$images = db_query(db_rewrite_sql("SELECT n.nid, n.title, f.filepath,
cti.field_iv_source_name_value AS source, bf.nid AS flagged
FROM node n
JOIN content_type_imagevault cti ON n.nid = cti.nid
JOIN content_field_att_file cfaf ON cfaf.nid = n.nid
JOIN files f ON cfaf.field_att_file_fid = f.fid
JOIN term_node tn ON tn.nid = n.nid
LEFT JOIN betterflag bf ON (n.nid = bf.nid AND bf.uid = %d)
WHERE n.type = 'imagevault' AND tn.tid IN (" . db_placeholders($tax_ids) .") AND n.status = 1
ORDER BY n.created DESC LIMIT %d"), $params);


texts: Recommended way to clone functionality to create a site in Drupal 8

texts:
I have a Drupal 8 installation with different content types, paragraphs defined, views and taxonomy vocabularies. Ideally I wanted to be able to export some of these features and import them in another site, to deploy sites quickly without having to define them.

So first I tried with the module Features, I have followed the tutorial http://www.beaconfire-red.com/epic-stuff/how-setup-features-module-drupal-8, but this module only brings problems. I have also tried the Configuration Installer module, but also gives me problems. And also changing the uuid in the new installation and trying to import the configuration. But there are always problems and errors. So the only solution I can find is just cloning the database, but I think it's just a dirty solution.

I'm not an expert using drush, but I was wondering if it is possible in Drupal 8, to create a profile installation where you can define the content types, paragraphs and views created to reuse them. Is it possible?

Is there another way to achieve what I need?  How is it possible that there is not an easier way to export just part of the functionality of a site?


texts: Displayng menu description under main-menu links in Drupal 7

texts: I am trying to display the menu description under menu links for the main-menu in my custom theme. I have tried overriding the function as given in this post http://fusiondrupalthemes.com/forum/using-fusion/descriptions-under-main-menu #10 comment. But its not working. Can anyone help me on this?


texts: How to render a node on behalf of another user (as an admin or without accessCheck)

texts:
Context : I use the following code to replace a token by a rendered node.
The resulted text is sent by email
$renderable = $view_builder->view($node, 'token', $langcode);
$replacements[$original] = \Drupal::service('renderer')->renderPlain($renderable);

This is working fine except when I am queuing the mails to be sent
Because, in this case, the upper code runs in a queue and NodeAccessControlHandler::checkAccess and NodeAccessControlHandler::checkFieldAccess are called with an anonymous account (id=0).
This leads to an AccessRessult::forbidden() (because in my setup, anonymous can't see those fields and/or this node) and the rendered node is empty...
Thus my question is:
How to render a node (in a queue) "in behalf of" an admin user?
or
How to explain to my overrided NodeAccessControlHandler that we are in a queue and that it can safely give access (without security concerns)


texts: Why can't my module install a database table?

texts:
I'm following the instructions on a module development training video. I try to install a table using the mysite/update.php page and everything goes well but no table is installed in the database. I'm lost for what might be wrong. Here's my code on a my_module1.install file:

/*
Implements hook_schema
*/
function my_module1_schema(){
    $schema = array();

    $schema['my_module1_node_views'] = array(
        'fields' => array(
            'nid' => array(
                'type' => 'int',
                'unsigned' => TRUE,
                'not null' => TRUE,
                'default' => 0,
            ),
            'uid' => array(
                'type' => 'int',
                'unsigned' => TRUE,
                'not null' => TRUE,
                'default' => 0,
            ),
            'view_count' => array(
                'type' => 'int',
                'unsigned' => TRUE,
                'not null' => TRUE,
                'default' => 0,
            ),
        ),
        'primary key' => array('nid', 'uid'),
    );
    return $schema;
}

/*
Implements hook_update_N
*/
function my_module1_update_7000(){
    drupal_install_schema('my_module1_node_views');
}


texts: How to have node id value set depending on some other id?

texts:
I have database table which I need to import it in drupal database (basically create a node for each row of database table ) .
 The non drupal database has mim Id .
I want to create a node which would have the mim Id == node id
So in all, how can I achieve such that Drupal's ID node will be SAME as article ID (this ID is used in an external media CDN server).

I tried looking at the CDN module but could not find a solution for the same


texts:
I am using Fivestar rating in custom print. See image:

I'm trying to print a fivestar as follows:

$your_average = $variables['result']['node']->field_rating['und'][0]['average'];
$your_maximum = "100";
print theme('fivestar_static', $your_average, $your_maximum);

But, I'm getting the following error:

  Fatal error: Unsupported operand types in /var/www/html/book1/includes/theme.inc on line 1088

Any suggestions?


texts: Override entityreference autocomplete and return entityfieldquery output

texts:
I am trying to override an entityreference autocomplete form item, I have managed to override the form, and get the arg passed to a hook_menu callback. However, I'm struggling with getting the callback to work based on what I type into the form box. Looking in the Entity reference module there is some code in the hook_autocomplete_callback that handles the $string argument and looks up matches $entity_labels = $handler->getReferencableEntities($tag_last, $instance['widget']['settings']['match_operator'] - something like that.

Can anyone assist?

My code:

/**
 * Implements hook_form_FORM_ID_alter().
 */
function wl_event_form_event_node_form_alter(&$form, &$form_state, $form_id) {
  dpm($form);
  // We will get our term id argument from the from build itself.
    $node_id  = $form['#node']->nid;
  // This is the path we will create in hook_menu().
     $new_path = "wl_event/autocomplete/{$node_id}";
  // Maximum number of descrete values (deltas) that are present.
 $max_delta = $form['field_wl_event_acquired_resource']['und']['#max_delta'];
  // Hijack the autocomplete callback for each of our values.
  for($x=0; $x <= $max_delta; $x++) {
    $form['field_wl_event_acquired_resource']['und'][$x]['target_id']['#autocomplete_path']= $new_path;
  }
}

/**
 * Implements hook_menu().
 */
// can be used to do a lookup on a menu path to return json
// probably entity reference autocomplete does a similar thing

//we want to get all of the resources of the user profiles of
//users who are registered on the event

//
function wl_event_menu() {
  $items = array();
  $items['wl_event/autocomplete/%'] = array(
    'title' => t('project call back'),
    'page callback' => 'wl_event_autocomplete_callback',
    'page arguments' => array(2),
    'access callback' => TRUE,
    'type' => MENU_CALLBACK
  );
  return $items;
}

function wl_event_autocomplete_callback($arg1, $string = '') {
  $query = new EntityFieldQuery();
  $query->entityCondition('entity_type', 'node')
  ->entityCondition('bundle', 'resource');
  // ->propertyCondition('nid', '1')
  $results = $query->execute();
  print_r(drupal_json_output($results));
  return drupal_json_output($results);
}


texts: 403 Error on AJAX Request in add new item (collection field)

texts:
I have normal content type which has 12 collection fields
each field has unlimited value
when i try to click add new item on any field it gives me ajax error

An AJAX HTTP error occurred.
HTTP Result Code: 403
Debugging information follows.
Path: /?q=system/ajax
StatusText: Forbidden
ResponseText:

I have another content type and also has collection field with unlimited value .. but it works without any problem
so please help me why some content type has error and the other doesn't have

by the way: i use D7 and i upgraded it to 7.35 but this problem was before the upgrading

i have checked all the answers in the Drupal Answers but unfortunately did it help

edit:

ResponseText:
@import url("http://example.org/modules/system/system.base.css?nlmla7");
@import url("http://example.org/modules/system/system.base-rtl.css?nlmla7");
@import url("http://example.org/modules/system/system.menus.css?nlmla7");
@import url("http://example.org/modules/system/system.menus-rtl.css?nlmla7");
@import url("http://example.org/modules/system/system.messages.css?nlmla7");
@import url("http://example.org/modules/system/system.messages-rtl.css?nlmla7");
@import url("http://example.org/modules/system/system.theme.css?nlmla7");
@import url("http://example.org/modules/system/system.theme-rtl.css?nlmla7");
@import url("http://example.org/sites/all/modules/date/date_api/date.css?nlmla7");
@import url("http://example.org/sites/all/modules/date/date_api/date-rtl.css?nlmla7");
@import url("http://example.org/sites/all/modules/date/date_popup/themes/datepicker.1.7.css?nlmla7");
@import url("http://example.org/sites/all/modules/date/date_repeat_field/date_repeat_field.css?nlmla7");
@import url("http://example.org/modules/field/theme/field.css?nlmla7");
@import url("http://example.org/modules/field/theme/field-rtl.css?nlmla7");
@import url("http://example.org/sites/all/modules/field_hidden/field_hidden.css?nlmla7");
@import url("http://example.org/modules/node/node.css?nlmla7");
@import url("http://example.org/sites/all/modules/recieve_orders/css/orders_styles.css?nlmla7");
@import url("http://example.org/modules/search/search.css?nlmla7");
@import url("http://example.org/modules/search/search-rtl.css?nlmla7");
@import url("http://example.org/modules/user/user.css?nlmla7");
@import url("http://example.org/modules/user/user-rtl.css?nlmla7");
@import url("http://example.org/sites/all/modules/views/css/views.css?nlmla7");
@import url("http://example.org/sites/all/modules/views/css/views-rtl.css?nlmla7");
@import url("http://example.org/sites/all/modules/admin_menu/admin_menu.css?nlmla7");
@import url("http://example.org/sites/all/modules/admin_menu/admin_menu-rtl.css?nlmla7");
@import url("http://example.org/sites/all/modules/admin_menu/admin_menu.uid1.css?nlmla7");
@import url("http://example.org/sites/all/modules/ctools/css/ctools.css?nlmla7");
@import url("http://example.org/sites/all/modules/adminimal_admin_menu/adminimal_admin_menu.css?nlmla7");
@import url("http://example.org/modules/shortcut/shortcut.css?nlmla7");
@import url("http://example.org/modules/shortcut/shortcut-rtl.css?nlmla7");
@import url("http://example.org/sites/all/themes/adminimal_theme/css/reset.css?nlmla7");
@import url("http://example.org/sites/all/themes/adminimal_theme/css/style.css?nlmla7");
@import url("http://example.org/sites/all/themes/adminimal_theme/css/style-rtl.css?nlmla7");
@import url("http://example.org/sites/all/themes/adminimal_theme/css/mobile.css?nlmla7");
@import url("http://example.org/sites/all/themes/adminimal_theme/css/tablet.css?nlmla7");ySite.org/sites/all/themes/adminimal_theme/css/tablet.css?nlmla7");

and there are too many custom modules in my site

but the thing which make me more conflicted is why it doesn't give error in the other content type


texts: The save() function permanently alters content when used with hook_preprocess_html. Is there a way to do the same thing for a single view instance?

texts:
I was planning to use an entity wrapper to conditionally fill in a (potentially) empty field. The use case is the following:

Some users want to manually fill in the field with machine name "field_citation".
Other users will not fill in the field.
If the field is empty, then I need to combine content from other fields to fill in the field_citation.

$Wrapper is a object created by the Entity API module and used to more easily manipulate content (clarification added due to request).

I thought the below code only would affect the view but apparently the save() function modify content in the database. So I need to learn how to properly display content in the field without permanently modifying it.

function theme_preprocess_html(&$vars) {

  if(isset($wrapper->field_citation)){

    if(!$citation_content = $wrapper->field_citation->value()){
      $citation = implode($author_citation); //retrieved from #authorlisting
      $citation .= $wrapper->title->value() . '. ';
      $citation .= 'Website name. ';
      $citation .= date("Y/m/d", $wrapper->created->value());

      $wrapper->field_citation = $citation;
      $wrapper->save();

    }
  }
}


texts: How to programmatically set the field formatter for a field given certain conditions

texts:
I have an entity 'house' with an address field. The address field comes with a default field formatter plugin. This is perfect for when i view my entity at its canonical route and where its view_mode is 'full'.
However I want to change how the address field is displayed when the 'house' has view_mode 'teaser'. For example at a page that displays a list of all my houses. To be specific I want my address to appear on one line.
Now, I have gotten all this working. Like this:
house_entity/src/Plugin/Field/FieldFormatter/AddressTeaserFormatter
<?php

namespace Drupal\rrre_entities\Plugin\Field\FieldFormatter;

use Drupal\address\Plugin\Field\FieldFormatter\AddressPlainFormatter;
use Drupal\Core\Field\FieldItemListInterface;

/**
 * Plugin implementation of the 'address_teaser' formatter.
 *
 * @FieldFormatter(
 *   id = "address_teaser",
 *   label = @Translation("Teaser"),
 *   field_types = {
 *     "address",
 *   },
 * )
 */
class AddressTeaserFormatter extends AddressPlainFormatter {

  /**
   * {@inheritdoc}
   */
public function viewElements(FieldItemListInterface $items, $langcode) {
  $elements = parent::viewElements($items, $langcode);
  foreach ($elements as &$element) {
    $element['#theme'] = 'address_teaser';
  }
  return $elements;
}

house_entity/house_entity.module
/**
 * Implements hook_theme().
 */
function house_entity_theme($existing, $type, $theme, $path) {
  return [

    'house' => [
      'render element' => 'listing',
    ],

    'address_teaser' => [
      'variables' => [
        'recipient' => '',
        'organization' => '',
        'address_line1' => '',
        'address_line2' => '',
        'postal_code' => '',
        'sorting_code' => '',
        'dependent_locality' => [],
        'locality' => [],
        'administrative_area' => [],
        'country' => [],
      ],
    ],
  ];
}

and in the same house_entity.module file:
/**
 * Implements template_preprocess_HOOK().
 */
function template_preprocess_house(&$variables) {
  $addressDisplayOptions = [
    'type' => 'address_teaser',
  ];
  $house->address->getItemDefinition()->getFieldDefinition()->setDisplayOptions('view', $addressDisplayOptions);
}

Finally I have my template for my new address fieldformatter all set up at house_entity/templates/address-teaser.htm.twig
This all works fine.
Except that the custom field formatter does not apply to the first 'house' in my list of 'houses' (it does apply to all subsequent 'houses') ... and adding a xdebug_break() immediately after the line:
$listing->address->getItemDefinition()->getFieldDefinition()->setDisplayOptions('view', $addressDisplayOptions);
Triggers the following error - basically that the twig template was not found:

Question?:
Do I have my template in the right place?
Is there a more convenient way of setting a field formatter for a particular field on an entity?


texts: Drush hangs only when executing a command on a remote machine

texts:
I am trying to use Drush to synchronise a local dev version of my Drupal site and I've set up the following alias file (spc.aliases.drushrc.php) in my .drush directory to allow Drush to connect remotely to the production server:

$aliases['spc'] = array(
'uri' => '[domain url]',
'remote-host' => '[domain url]',
'remote-user' => 'root',
'root' => '[drupal root path]',
'os' => 'Linux',
'path-aliases' => array(
'%drush-script' => '/root/.composer/vendor/bin/drush',
'%files' => '/sites/default/files',
),
);

But when I try to use Drush to connect to this server remotely from my local machine, it just hangs with no error message. The command I'm using is:
drush @spc status

If I use -d on this command to show the debug, I can see that Drush is running this command:
ssh -o PasswordAuthentication=no root@[site url] "/root/.composer/vendor/bin/drush --debug --uri=[site url] --root=/home/sitename/htdocs --verbose core-status 2>&1" 2>&1

And I can run this ssh command successfully from my local machine, so I can't see why Drush is hanging when it tries to run it.

I'm using Drush 8.0.3 on both the local and remote machines.

Any ideas what might be wrong?


texts: How to identify item_selector for Migrate API JSON imports

texts:
Trying to import articles from an external JSON feed of "members" with a structure like this:

{
   "status":"OK",
   "results":[
      {
         "num_results": 10,
         "offset": 0,
         "articles": [
              {
                 "id": "1",
                 "title": "First article",
...

And I haven't been able to isolate the correct values to use for item_selector to get it to point to the array of "articles":

source:
  plugin: url
  data_fetcher_plugin: http
  data_parser_plugin: json
  urls: http://example.com/eample.json
  item_selector: /results/members/

The error I continually get in the console is:

  [error]  Could not retrieve source count from import_your node: Passed
  variable is not an array or object

Would be grateful for an explanation of exactly how item_selector is defined or a pointer to documentation for the same.


texts: Which module will allow a user to grant another user permissions for editing content of content type

texts:
I have a content type of 'project' and I want the creator of this content type to be able to allocate other users to be 'admins' on this project, so they have extended rights to edit the project details, archive the project, approve users attached to that project.
Is there a module that sounds like it can achieve some of this stuff?
thanks


texts: Can I use the Services module without coding skills?

texts:
I'd like to create an xmlrpc endpoint to import (add, update, delete) users from one Drupal site to another and believe that the Services module is the right tool for the job. However, by reading the documentation and looking at the screencasts out there, it seems to me that it requires some coding skills (like the Migrate module) in order to get the most out of this module.

I'd like to know if I could import my users with this module without any coding skill or if it requires more developers skills.


texts:
I would like to create an Asset Management Inventory for our corporate helpdesk. There is a list of assets (laptop, phones etc) which our ICT staff members can borrow from the helpdesk. Members would not have direct access to the system, the main user would be just a helpdesk admin managing the loans.

These are the entities I'm planning to use but I'm not really sure how should I design my content types and how to link them with each other.

Borrower Information

Full Name
Username
E-mail
Telephone
Area
Office No.

Asset Details

Name
Model
Scope.

Loan Information

Borrowed On (date)
To be returned (date)
Updated On (date).

I was thinking about using a Field Collection as a Loan History as part of every Asset, in which the Borrower and the Loan Information would exist. So every time I need to create a new Loan record, I would choose the Borrower as an entity and fill in the Loan Information. If the Asset or the Borrower doesn't exist in the system, I would like the admin to be able to add them.

I'm not familiar with the Entity Reference module and I don't know if it would fit to my scenario. I need some guidance I'm afraid.


texts: Drupal 8 status code set 301 instead of 302 for urls with out lang code

texts:
I have an article with url alias '/gettting-started' and it is translated in several languages.

Lang codes for other languages is set like the following.

For German:de-de, English: en-us.

In 'admin/config/regional/language/detection' Detection and selection languages, priority is set to 'URL' then 'Browser'.

My browser locale set to German first,so when i try to visit the article with the /getting-started, it is redirected to /de-de/getting-started with the status 301.

The status code 301 is creating the problem for me as the response is cached at varnish cache (for 301 response codes).

The other user, with English as priority in Browser language visits /getting-started redirects to /de-de/getting-started

So, instead of sending 301, how can i send 302 redirect for urls without language code as a prefix.


texts: Give permission to dealer_user_role to create users and profile2 fields

texts:
I have situation as follows:

I have three types/roles of users.

AdminRole
Dealer Role
CustomerRole

I have given permission to "Dealer Role" to create/add "Customer Role" user.
That works fine for me.

But my daunting task is as follows:

I am using "Profile2" module for "Customer Role" user.

I have created one profile_type in Profile2 module in which 6 fields are there with separate page for editing profiles page.

Also i have enabled UNIQUE REGISTRATION Path.

Although i have access to the unique registration path when none of the user is logged in system and administrator is log-in.

I want to give "Profile2" module permission in a way that "Dealer Role" having permission to create/add data to the "Customer Role".

In simple, when "Dealer Role" is logged in system, dealer can manage "Customer Role" user.

Thanks
Same


texts: How can I change the way content titles are generate and displayed?

texts:
I'm a total amateur working on the website for my community radio station via Drupal 7. (Here for reference) Each show on the station has their own content type called a Program Page, which displays, at the bottom of the page all the Program Playlists (a type of content) they have created by clicking a link on the Program Page and filling out the 'Create Program Playlist' form (http://www.cjsf.ca/node/add/station-playlist/685).

Currently these playlists are listed by an automatically-generated title that is just the date the episode aired (a field within the 'Create A Program Playlist' form), and we'd like to be able to assign custom titles to these playlists.

I can't for the life of me figure out how to do this. I've tried editing the content type for the Program Playlist but all I have there is an un-editable 'Title' field and I can't get much further than that.

Help!


texts: i18n-Frontpage: inconsistent links to non-default language

texts:
I am running across some inconsistent behaviour regarding the links to the  frontpage of my multilingual site. The following is happening:

mysite.com -> English frontpage, correct

mysite.com/en -> English frontpage, correct

mysite.com/en/node -> English frontpage, correct

mysite.com/de/node -> German frontpage, correct

mysite.com/de -> English content but language switcher says it's German, should display German content

Did anyone experience something similar? I have an idea why this is happening but no clue how to fix it.

I didn't find anything here. The closest one was this, but I already have a working link to the German frontpage, so it doesn't really apply to me. https://stackoverflow.com/questions/5168289/multiple-frontpages-in-mutiple-languages.

Best regards,
Christoph

P.S.: All my images with relative links in Blocks or Pages get the language tag set in front of them. Is this a corresponding thing or default i18n behaviour? I just hotfixed it with softlinks from en/images and de/images to images.


texts:
At first, I am new in SAML. Could somebody tell step by step, how to configure SSO on Drupal using simplesamlphp? Or how to test by "Test configured authentication sources"?

What I have now.

Installed simpleSAMLphp Authentication module.
Add simplesamlphp library to my site (mysite/simplesamlphp).
Changed config.php
Added meta to saml20-sp-remote.php

$metadata['name'] = array(
'SingleSignOnService'  => 'url_login',
'SingleLogoutService'  => 'url_logout',
'certFingerprint'      => 'key',
);
When I go to mysite/saml_login, I am return to login page on IdP. After login I return to my site (mysite/sso/login?params) with SAMLRequest and other GET-params. But site show page not fount error. On wiki it step 2.

So what I did wrong? May be I must set same page callback to handle this GET-params?

I also try to did this by simplesaml "Test configured authentication sources", but I got the same result.

Please, help!


texts: Can you modify the settings.php file using drush?

texts:
I am trying to create multisites and the first one is up fine and running.  I am trying to use drush to install a 2nd site but I need the settings.php file to point to a different db.  Can I modify my drush command to do that or am I going to have to modify the settings.php by hand each time?

sudo drush -y site-install standard --db-url=mysql://$username:$pass@127.0.0.1:3306/$dbname --site-name="$sitename" --sites-subdir="$sitename"


texts: How to programmatically set the front page?

texts:
I want to set the Drupal front page programmatically at run time.
How can I do this? Is this possible?


texts: Multi-country and multi-language website

texts:
I’m trying to create a Drupal 8 website with multi-country selection and more languages available for each Country. For example, the visitor can select Belgium as his Country, then he should be able to select one of the languages related to Belgium: French and German, plus English (which should be available for all Countries). I’ve installed two modules: Domain Access and Country Path. Domain Access allow me to define different domains and sub-domains like fr.domain.com, it.domain.com, etc. Using Country Path I should be able to create different path for the same domain based on Country selection, like domain.com/france, domain.com/italy etc. But unfortunately it’s not working properly… Using sub-domains is not possible for my project and, even configuring Country Path, if I go to domain.com/france I always get a page not found error.

What I need in the end is this path/url structure: domain/country/language, like for example domain.com/belgium/fr or domain.com/belgium/en. Do you had any experience with this situation? Any idea or suggestion about modules to try or core configurations that can solve this?


texts:
I have a view that shows a list of Article nodes which can be sorted where the sorting fields are exposed to users. When the view is shown as page, the sorting fields are rendered, but when the view is shown as block, the sorting fields aren't rendered.
How do I show sorting fields to users when the view is added as block?


texts: Filter search results based on user field

texts:
I have previously created a view to search my different content types and it behaves like I want it to.

Now, I would like to limit the search results based on a user profile field. Each content type has an access level field. The access fields are tiered as follows:

A: every one can see it
B: only authenticated users can see it
C: only authenticated users with a certain profile property can see it

C users can see everything.
B users can see B and A content.

My first attempt at this was using a contextual filter and this sort of works. However, it only returns nodes that match the access tier.

I did this with PHP contextual filter code:

$memberAccessLevel = 'Public';

if (!empty($argument->field_membership['und'][0]['value'])) {
    $memberAccessLevel = $argument->field_membership['und'][0]['value'];
}

return $memberAccessLevel;

My question is, how can I set up the view so that tier C members can see all content?


texts: I am using Drupal 7 and I would like to render a link (anchor tag) the same as a submit button. Does Drupal 7 allow for this (say by using the button type) or do I have to use CSS to accomplish this?


texts: Is there a simple way to update a module to the dev version without Drush? Ideally, within the admin console, but I could also use ssh to manually loa the files to the correct places. For the purposes of this question, assume Drush sadly doesn't exist.


texts: Efficient/Correct way of accessing a field of a referenced node

texts:
I have an Article node with a field_recipe field which references multiple Recipe nodes which has a field field_image.

In the Article node template I have this in my code:

$recipes_raw = field_get_items('node', $node, 'field_recipe');

How do I get the field_image from $recipes_raw?

Currently, what I'm doing is this:

foreach($recipes_raw as $r) {
    $recipe_node = node_load($r['target_id']);
    $field_image_raw = field_get_items('node', $recipe_node, 'field_image');
}

However, I'm not very sure if this is an efficient approach since I'm reloading a node which is already part of the current node I'm in.


texts: Letting users vote for one node per category

texts:
I'm working on a D7 site for a yearly "Best of town"-style competition, with businesses submitting listings (Each a node and placed in a taxonomy) and users voting on their favourite node in each of the six categories in the aforementioned taxonomy.

Drupal seems to have a lot of voting modules geared towards ranking stuff out of x (I.e., fivestar) but less so for choosing one (and only one) node in a series of categories. Any idea how I'd do that?

Thanks!


texts: How allow users to add menu entries only in second level?

texts: i want my users to be allowed to add links only to the second level or lower of the main menu, but not to the first. How can i do this ?


texts: Get all enabled viewmodes of a entity/bundle

texts:
I need to get all possible viewmodes of a specific entity/bundle in D8.
Currently I have this:

$viewmodes = \Drupal::service('entity_display.repository')->getViewModes($entity_type);

This shows all viewmodes on an entity, it doesn't filter on bundle.
Also, the default viewmode is never included here.

Anyone knows a better way?

Cheers, Tom


texts: Views relationships with two views blocks

texts:
I am trying to connect two different block views so as when you click the title of the first view block the second block will display the content of the url. Both views are of the same content type. How do i do this? or any usefull tutorials i can count on?

EDIT:
I have this company news page which is accessible from the main menu so that's why i wont to keep the same url. So i created a content type called company news and two views. The first view will display the date and the title of the company new and the second view block will display the content of the company new clicked. My first view is like a left-hand side bar with the 10 newly added. So if a user clicks for example at the second company new the second view block willk display the content of that new. I hope i made it more clear!


texts: Can a Drupal Site Administrator view contents of settings.php or some other file in file system?

texts:
We are using Drupal 8.6.3.

I want to store some configuration in file system (in settings.php or some other file outside Web Root).

Can a Drupal Site Administrator view that configuration?

What parts of settings.php file can be viewed by a Drupal Site Administrator?


texts: Kep getting "access denied" when using a "user-cancel" link

texts:
I'm developing a simple troubleshooting menu on Drupal 7 to allow users request a new password or cancel their account depending on some factor. To do so I basically call

$mail = drupal_mail('user', $op, $account->mail, $language, $params);

using the corresponding $op.

I have a problem with the most basic thing, which is accessing the account cancellation form after sending the email with the corresponding URL. The cancellation page keeps giving me "Access denied", even if I am admin.

I checked the permissions and I've already allowed all users to "Cancel own user account", so that's discarded.

The emails are going through just fine and sending a one-time-login-link worked flawlessly. I just can't seem to open the account cancellation link.

Any ideas?


texts: Is there a way to alter the implementation of a hook given by a third-party module, or a core module?

texts:
I have a module that should replace the implementation of a hook done by another module.
Is it possible to do it, with Drupal 7? If it is possible, under which conditions is possible?

By replacing the implementation of a hook done by another module, I mean using a function that is automatically called by Drupal when that module is enabled. For example, if the Poll module is enabled, then Drupal should call the poll_user_restriction_info() or the poll_metatags_info() (where hook_user_restriction_info() and hook_metatags_info() are custom hooks used by my module) function present in my module files.
I could use a function in my module that loads some include files from my module directory (e.g. poll_custom_hooks.inc) basing on the enabled modules, but I am looking for a system that would allow Drupal to automatically load such files.


texts: Webform mail template how to exclude empty children of fieldsets

texts:
This is Webform module Version: 7.x-4.8
I have a webform with 2 levels of fieldsets before getting to the components . When the email is sent, all the fieldsets are included in submission:values, even if the components are empty. I want to know how to exclude the fieldsets when the actual components are empty. The "Exclude empty components" checkbox does not seem to work with fieldsets.
Any help would be much appreciated. :)
Thanks.


texts: Is it possible to add classname to render array of node title using entity meta wrapper?

texts:
I would like to know how to add a class name to node title by altering the render array. I examined the wrapper object

$wrapper = entity_metadata_wrapper('node', $nid)

by using

dpm($wrapper->getPropertyInfo())

and

debug($wrapper)

but got not the smallest idea how to change the markup of the title, i.e. adding a class name.


texts: Read data using countries module in view

texts:
I am using the countries module to add countries in my content type project.

I create a view with type = Default node index to display my content.

I added the Indexed Nœud: Countries (Countries)

But the data saved in my field_countries is not displaying yet it is displayed well in the details page (node project).

Any idea to display the countries data in my view?

Thank you


texts: Commerce Email email doesn't send to admin with anonymous checkout

texts:
I want to be able to place the line items from the customer's order into an email to the admin, but not the user themselves. The built in option in DC doesn't have a token for the line items after submission. The Commerce Emails module solves the line item problem by providing a token for those line items, but the module doesn't send out an email to the admin user when an anonymous user submits the cart. See the issues in  https://drupal.org/node/2030233.

How would I go about setting up a Rule that hooks into the email function in the Commerce Email module? I didn't see any obvious functions that specified the recipients, so I'm a little lost as to where to proceed from here. Any advice is appreciated.


texts:
I'd like to use the colorbox module to show the images in my nodes which are comming from flickr.

I'm using the flickr input filter which works fine. Now I'd like to get a colorbox to show one image after the other when the user clicks on one of the images of a set.

I installed the colorbox module and the jquery plugin. If I look at the HTML source file everything looks ok, but clicking on the images leads to flickr instead of opening a colorbox. According to the docs of the flickr module, colorbox support should be built in.

Any ideas what's missing?

You can see the non working page at my blog.


texts: hide a view field content for anonymous only?

texts:
How can I hide a field for the anonymous user in a view?

Logged in users should still be able to see the field.

(Drupal 8.3.0)


texts:
I'm trying to add a new product type, but I can't find the tab for the product types.

In Manage product structure, it is very clear where that tab is, but I cannot find it.

I'm using Drupal 7.59 and Commerce Kickstart 2 with demo.


texts: Is there a simple way to notify users about new posts on the site?

texts:
I want my users to be able to "subscribe" to new content that is posted on my site.

I've looked at the Notifications and Subscriptions modules and they are just massive! I've also looked at Simplenews (which which has a very attractive name), but it seems targeted towards distribution of a custom newsletter and not sending out general notifications about new content posted on the site.

Is there simple a way to set up a rule (by means of the Rules module) to accomplish this?


texts: Is there a Tokens module that allows for simple boilerplate embedding? For example, embedding [notification 3] into a node would correspond to an admin setting(notification 3 = "Hello World"). You would then have "Hello World" embedded into all nodes with [notification 3].


texts:
If I am using the menu_tree_all_data command, how can that be modified to just get some data, not all?  in other words I want to get all of the menu items, but not all of the information, eg
updated: "0",
load_functions: null,
to_arg_functions: null,
access_callback: null,
access_arguments: null,
page_callback: null,

which I don't need.  Thanks


texts: How to export / import images uploaded using CKeditor

texts: Exporting and importing image fields is easy. How to export images uploaded using CKeditor in the body field of node? I have a view which exports the content from D6 (in XML format). In D7 i have feed importer which imports the content. I can add all fields in view and get all data exported. This works well for everything except images placed in body field. They don't get migrated as it is not part of node field.


texts: conditional removal of a field in a view

texts:
I'm displaying the latest 5 nodes (teaser view mode) in a sidebar region using views. The nodes have an image field but I only need to render that on the first node on the list.

So, since the teaser view mode does include the image, I'm trying to remove the image from all nodes apart the first upon rendering.

I've tried the following in my theme's template.php:

function foo_preprocess_views_view(&$vars) {
  if (isset($vars['view']) &&
      isset($vars['view']->style_plugin) &&
      isset($vars['view']->style_plugin->row_plugin->nodes)) {
    $first = true;
    foreach($vars['view']->style_plugin->row_plugin->nodes as $node) {
      if (!$first) {
        unset($node->field_image);
      }
      $first = false;
    }
  }
}

But the image is still being rendered. I think that this has to do with the fact that I'm trying to temporarily remove the image from the wrong datastructure which represents the node state.

I then tried using the hook_preprocess_node with something like:

unset($vars['field_image']);

But it still has no effect. The image was still there.

How is this solved? And at which layer is it solved best?

I know I could simply hide via CSS by using the .views-row-first class but I don't think this is optimal.


texts:
I am trying to get option value from node in drupal rules. I have a form-group which consists of fields. The field in question is a select list - it consists of different names, with every option there is an email. They are stored in this way:

0|NONE
example@example.com|EXAMPLE
example2@example.com|EXAMPLE2

So option value for EXAMPLE is example@example.com
Let us call this field operator.
So I want to send/get email from this node
What I have atm in rules is
    [node:field-operator:value]
which does not work.
    [node:field-operator]
for example just fetches the name e.g EXAMPLE.
 I have tried tons of ways by now but I know that solution must be simple, it's just my first time using drupal and been looking for an answer for hours.
Thank you for your help.


texts: How to sort view by content type, using literal ordering, as second order-by clause

texts:
In a view, I want to sort content by:

Collection (a taxonomy term)
Content type
Something else
Something else ...

I have this configured in the View UI and I want to leave most of it as it  is but for the content type ordering, I want to make this literal - I want to state the order exactly ("article", "page", "thingy", "other one").

For this in MySQL you would use FIELD()

I have tried using hook_views_query_alter and setting $query->orderby[1][field] to FIELD(node_field_data_type, "article", "page", "thingy", "other one") but I am running into exactly this problem: https://www.drupal.org/node/1382016#comment-12058755 In other words, the brackets and quotes are being removed so that it thinks it's one long field name (which of course does not exist) rather than treating it as a function call. It seems this did not happen in Drupal 7.

Is there a known way to get around this in Drupal 8?


texts: Replacing initial view of a panel with a content view

texts:
I have a Panel that is supposed to show initially a Taxonomy view and a set of filters for a Content view. If the user hits any of these filters, my taxonomy view fades out and shows my content view.

Is it there any easy way of doing this, without having to create a personalized template file with some javascript under the hood?


texts: Set Width full 100% item sub menu in TB_Megamenu Drupal 7

texts:
I used module tb_megamenu Drupal 7 which version "7.x-1.0-rc2" ! I had three item submenu . The first and second sub show list text ,but three sub show all group. I want three sub menu set width 100% ! But this problem not support in UI TB Mega menu ! So if I want change item submenu width 100% how to change or fix it !

Thanks !


texts: How do I implement a clickable JavaScript map?

texts:
I've found a great clickable map over at code canyon which includes all the JavaScript, CSS, and XML to make it happen. A demo of the map can be viewed here.

I figure the best way to accomplish this would be to create a custom module and load the JavaScript, XML, and CSS files via the .info file.

The code to display the map is a simple html statement or two that could be placed on a basic page.

Would it be better to create a page template specific to the node?
How does one load the CSS and JavaScript from the module to the page?


texts:
I am having some problems when I try to log in to my drupal site. When I visit http://mysite/user, i am getting redirect to the login page and in my url appears something like this:

user?name=user&pass=111111&form_build_id=form-iCrzIe6KBq1g5MoA3z0JeBI98QU8q2f-FvfcIcp3Cvk&form_id=user_login&op=Log+in

I'm trying to find the problem, but I don't know what to do.

When i restore the site(from my last backup) i can do the login, but when i restart my machine, the problem comes back.

I hope you could give me a hand with this problem.

Regards


texts: Contextual Links add destination=node to URL - can i restrict that from happening? - stopping delete functionality

texts: I have a contextual link on a block that will take the user to an admin screen with a delete button on the admin screen.  The delete button works fine when not coming from the contextual link.  I noticed the contextual link adds "destination=node" to the end of the URL.  The fact that the contextual link adds that to the URL does not allow for my admin screen to redirect to the delete confirm admin screen.  If i remove the "destination=node" from the admin screen URL, it goes to the delete confirm admin screen with no issues.  Has anyone else had this issue?  I noticed this is for absolutely any module or block in drupal.  If going to the admin screen from a contextual link and it has a delete button on the admin screen, the delete functionality will not work!  Any suggestions?


texts: How to pass a value from form(block) to the page and show this page?

texts:
I created a block with a form (elemnts: textfield and submit). Also have a page created by the hook_menu. I want that when you click on submit in block, the value from textfield transmitted to a page that is created using the hook_menu and show this page with data from textfield.
In the future I plan to transfer some text in the html markup or array.


texts:
Hi i hope someone can offer me a bit of advice here. I seem to have deleted all my admin menu items. Is there a way to restore them without losing any data on my site?

thanks


texts: drupal_http_request() returns "Invalid JSON primitive"

texts:
I am developing a module for Drupal 7 which calls a remote API. I am using drupal_http_build_query(), drupal_http_request(), and drupal_json_decode().
My code is as follows
$username = $form_state['input']['name'];
$password = $form_state['input']['pass'];

$authurl = variable_get('sgauth_base_url_authenticate', '');
$headers = array('Content-Type' => 'application/json');
$data = array('email' => $username, 'password' => $password);
$query = drupal_http_build_query($data);
$options = array('headers' => $headers, 'method' => 'POST', 'data' => $query);
$result = drupal_http_request($authurl, $options);

dpm($result);

$authurl is returning the correct url for the API.
When I look at the returned object I see the following
The request is (Note host, username and password have been hidden)
POST /SingPostApi/MobileAuthenticate HTTP/1.0
Content-Type: application/json
User-Agent: Drupal (+http://drupal.org/)
Host: xxxxxxxxxxxx.xxxxxxxxxx.com
Content-Length: 36

email=xxx%40xx.xxx&password=xxxxxxxx

Which seems OK
$result->code I see a 500 error
$result->data shows Invalid JSON primitive: email.
As far as I can tell my code is OK based on my reading of the Drupal API. I don't understand why I am getting the wrong data returned.
When I make he POST request from the Firefox HTTP Requester I get a 200 code and the data I expect to see returned
I would appreciate it if someone who can see where I am going wrong can point me in the right direction.


texts:
I have extracted the dompdf libraries folder to /sites/all/libraries

Re: 2. Edit dompdf_config.inc.php to fit your installation.

What exact changes do I need to make to this file???

Also, I am getting this warning in the drupal admin:

  Warning: in_array() expects parameter 2 to be array, integer given in print_pdf_settings() (line 22 of /home/mysite/public_html/sites/all/modules/print/print_pdf/print_pdf.admin.inc).


texts:
How can i add this meta tag in my website :

<meta http-equiv=“content-language” content=“en-us”>     ?

I am using metatags module but i dont see any option about this. Is there any other way to do it?

Thank you


texts: Is it possible to create a block that allows users to sort the nodes in a view? I've only been able to achieve this in a page using the menu in page settings but so far haven't had any luck with blocks. The thing is I need the block to appear on most of the site's pages. Any ideas...?


texts: How do I use dependency injection on \Drupal::moduleHandler() to a Controller?

texts:
I am using the following line in a controller class.

    \Drupal::moduleHandler()->alter('mymodule_myfunction', $plugin_items);

Pareview.sh is giving me this error message.

  \Drupal calls should be avoided in classes, use dependency injection instead.

How should I accomplish this? Do I need to create a constructor, create a method, or a service? If so, what code should the service need? I found an example on "Drupal calls should be avoided in classes, use dependency injection instead" for a case where a service already exists.


texts:
I'm trying to import some nodes into a new D8 installation. Therefore I wrote a module. Importing nodes is already working perfectly.
As you can see in my code snippet, I'm using the $field_array variable to create the nodes.
Now my questione: is it possible to use this variable also for the node update functionality?

Regards

M.

 public function ausgabe($import_node,$action,$new_old_uid,$new_old_nid) {
    global $content_type;

    $lang = $this->get_current_language();

    $field_array = [
        'uid' => $new_old_uid["new_uid"],
        'type' => $content_type,
        'langcode' => $lang,
        'status' => $import_node->status,
        'created' => $import_node->created ,
        'changed' => $import_node->changed ,
        'title' => $import_node->title,
        'body' => [
            'summary' => "",
            'value' => (isset($import_node->body) && !empty($import_node->body)) ? $import_node->body : "",
            'format' => 'full_html',
        ],
        'field_teaser' => [
            'value' => (isset($import_node->teaser) && !empty($import_node->teaser)) ? $import_node->teaser : "",
            'format' => 'full_html',
        ],
        'field_onid' => array('value'=>$import_node->nid),
        'field_image' =>  $this->get_set_images($import_node->field_ausgabe_bild),
        'field_files' => $this->get_set_files($import_node->files),
    ];

    if($action == "create") {
        $node = Node::create($field_array);
    } else {
        $node = Node::load($new_old_nid["new_nid"]);

    }
    $node->save();

    \Drupal::service('path.alias_storage')->save("/node/" . $node->id(), '/'.$import_node->path, $lang);
    echo $action.": Node " . $import_node->title . ' ('.$node->id().') <br>';

    $this->pre("",true);

}


texts: How do I implement two-way node references?

texts:
The node-reference module (a component of CCK) provides a great way to create a reference one node from another. What is the best way to expose a two-way relationship between the two? Example below:

For instance, in a ticket tracking system with two tickets (nodes) A & B, you could create a node reference from ticket A --> B and mark B as a child. When viewing ticket A it would be trivial to display this information. However, I would also like to display this relationship when viewing ticket B and show ticket A as its parent.

This same requirement would also apply in non-hierarchical situations (tickets C & D) with a reference from C --> D, the relationship should be exposed on ticket D as well as on C.


texts: How to prevent users uploading images from their system?

texts:
I have some image fields on my site.

My requirement is that the user should not be able to upload an image. Instead there will be a directory where I will place some images. And the user can only select an image from those images through image field.

Is it possible?


texts:
I am using a cURL to notify remote site of some updates on my site. I use it with
hook_user_update()  which is used when user data is saved. Problem is that it takes a lot of time to do that (maybe slow remote server). User saving is slow and it takes sometimes a minute or two.

How could I make this work that cURL doesn't hang user update and they are not dependent in this way?

This is the code I am using now

/**
 * Implemention of hook_user_update(), Notify OS after updating user account
 */
function os_integration_user_update(&$edit, $account, $category) {
  $query = array(
    'source' => 'web',
    'action' => 'nCustomer',
    'customer_id' => $account->uid,
    );

  $url = url('http://admin.com/synch/index.php', array('query' => $query));

$username = 'admin_os';
$password = 'admin_pass';
$basic = base64_encode($username . ':' . $password);

$headerArr = array();
$headerArr[] = 'Authorization: Basic ' . $basic;

$ch = curl_init( $url ) ;
curl_setopt ($ch, CURLOPT_HTTPHEADER , $headerArr );
curl_setopt( $ch, CURLOPT_HEADER, 1);
// Execute
curl_exec($ch);

// Check if any error occurred
if(!curl_errno($ch))
{
 $info = curl_getinfo($ch);

 echo 'Took ' . $info['total_time'] . ' seconds to send a request to ' . $info['url'];
 watchdog('lelo_os_integration_os_error', 'Took ' . $info['total_time'] . ' seconds to send a request to ' . $info['url']);
 // other info data http://php.net/manual/en/function.curl-getinfo.php
}

// Close handle
curl_close($ch);
}


texts: Easiest way to hack Drupal 6.22 installation for security audit

texts:
I am doing a security audit for a client.  Their installation is Drupal 6.22.  I need to show them it's unsafe.  What is the easiest way to hack it as an example?

I would need to directly show them the steps, so it must be quite detailed instructions.  They have the following modules installed:

Administration menu
Color
Comment
Database logging
Help
PHP filter
Taxonomy
Update status
Masquerade
CKEditor
AES

Here are some common settings:

Server      Apache/2.2.3
MySQL database  5.0.77
PHP     5.2.17
update.php  Protected
File system Writable
register_globals    Disabled


texts: Input format to save page links by ID but render by the URL alias?

texts:
I would like an input format that works roughly like this:

I can enter links to other pages on my site using a special syntax, but importantly, I reference them by their current URL alias.
When the page is saved to DB, the filter replaces them with node IDs, which never change.
If I edit the page again, the filter replaces them back with current URL aliases before showing it to me. That way I know what the links are and I don’t even have to care that the DB actually stores node IDs.
When the page is rendered, the links are rendered to the URL aliases, rather than node IDs.

Is there anything out there that does this already?

Why I want this: so that I can change URL aliases without breaking existing links. I do have automatic redirects created, but that's not quite the same thing. I want pages to link to the correct URL when I change an alias.


texts:
I want to store a template for my content-type in a module. This module provides the content-type (via features). My template "node--my-content-type.html.twig" should be in this module, too. Not in the Themes templates/ folder.

I know there are some related questions yet. I think I got the first step already; Drupal is recognizing my template and is outputing its contents.

In Drupal 7 the approach was made with something like this:

function mymodule_theme($existing, $type, $theme, $path) {
  return array(
  'node__my_content_type_machine_name' => array(
      'render element' => 'elements',
      'template' => 'templates/node--my-content-typee-machine-name',
    )
  );
}

Drupal 8 recognizes the template when I change this a bit.

'template' => 'node--my-content-type-machine-name'

So far so good. But now I am trying to render a field in my template and here I am failing.

{{ content.field_body }} ==> This is doing **nothing**

In my theme´s template-folder this is working fine. Any ideas?


texts: How do I add the edit link of a content in a custom view mode?

texts:
I have a content type (Sample) which includes a field (A) whose widget type is View. I'm using the Entity Reference View Widget View module for this.

The output of this field is having only the title of the node added from the view, but I want also the Node Edit link.

As far as I know, the output of Entiy Reference View Widget View can be printed with any custom view mode. I'm trying to add the node edit link in this custom view mode.

Do you have any idea on how to add a custom field having the edit link in the view mode?The steps which i followed are:

Step 1:I selected the particular view mode in the content type field settings A:
Here is the screen shot:

Step 2: In Display suit fields(admin/structure/ds/fields) i have added custom edit link field like Edit
I can see Edit link in the output ,but the  token value i provided [node:nid] is not fetching the node id. Link is redirecting to node/edit/%5Bnode%3Anid%5D .Can anybody help me in this? Please the below screenshot

Correct me if i'm wrong.
Any other approach or method is also fine.


texts:
I am build a JSON export using a View in Drupal 8. Problem is that the parameters for retrieving the json doesn't seem to work as I would want.

In my View I need use two exposed filter criteria to select a date range.  Both fields are Date and Time fields. When clicking on one of the criteria I have created it says:

  Value type

  A date in any machine readable format. CCYY-MM-DD HH:MM:SS is
  preferred.

I would like this url with this parameter values to work: http://example.com/api/?start=20161101&end=20161102

I thought it was working at first, but apparently not when I get my results.

This works:

http://example.com/api/?start=2016-12-08%2000%3A00%3A00&end=2016-12-21%2024%3A00%3A00

I am trying to have those clean parameters instead. How can I change the filter format to use the YYYYMMDD format? I don't want to change my field type because it is storing the time for my events. I want to get the data through only dates.


texts: Access denied to my route, created in module.routing.yml

texts:
I'm having a hard time trying to figure out why my custom route is returning a 403 status.

My routing.yml file:

lightbox.content:
  path: '/lightbox/content'
  defaults:
    _controller: '\Drupal\lightbox\Controller\LightboxController::content'
    _title: 'Hello World'
    requirements:
      _permission: 'access content'
      _access: true

My permissions.yml file

access content:
  title: 'Access Content'
  description: 'Read all content'

Permission page: